Advertisement
Guest User

Untitled

a guest
May 12th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2. include_once('templatecode/db.php');
  3. $user_name=$_POST['username'];
  4. $password=$_POST['pass'];
  5.  
  6. $user_name = stripslashes($user_name);
  7. $password = md5(stripslashes($password));
  8. $user_name = mysql_real_escape_string($user_name);
  9. $password = mysql_real_escape_string($password);
  10.  
  11. $result=mysql_query("SELECT * FROM users WHERE username='$user_name' and password='".$password."'");
  12. $count=mysql_num_rows($result);
  13. $row = mysql_fetch_array($result);
  14. $is_admin = $row['isadmin'];
  15.  
  16. if($count==1){
  17.  
  18. session_register("user_name");
  19. session_register("password");
  20. session_register("is_admin");
  21. header("location:index.php");
  22. }
  23. else {
  24. $content = "Wrong Username or Password";
  25. }
  26. include_once('templatecode/header.php');
  27.  
  28.  
  29.  
  30. ?>
  31.  
  32. <h2 class="title">Login</h2>
  33. <div class="entry">
  34. <p>
  35. <?php echo $content ?>
  36. </p>
  37. </div>
  38.  
  39.  
  40. <?php
  41. include_once('templatecode/footer.php');
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement