Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once('templatecode/db.php');
- $user_name=$_POST['username'];
- $password=$_POST['pass'];
- $user_name = stripslashes($user_name);
- $password = md5(stripslashes($password));
- $user_name = mysql_real_escape_string($user_name);
- $password = mysql_real_escape_string($password);
- $result=mysql_query("SELECT * FROM users WHERE username='$user_name' and password='".$password."'");
- $count=mysql_num_rows($result);
- $row = mysql_fetch_array($result);
- $is_admin = $row['is_admin'];
- if($count==1){
- session_register("user_name");
- session_register("password");
- session_register("is_admin");
- header("location:index.php");
- }
- else {
- $content = "Wrong Username or Password";
- }
- include_once('templatecode/header.php');
- ?>
- <!-- content goes here -->
- <h2 class="title">Login</h2>
- <div class="entry">
- <p>
- <?php echo $content ?>
- </p>
- </div>
- <?php
- include_once('templatecode/footer.php');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement