Guest User

Untitled

a guest
Aug 9th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. include 'connect.php';
  6.  
  7. $username = $_POST['username'];
  8. $password = $_POST['password'];
  9. $password = md5(md5($password));
  10.  
  11. if ($username&&$password){
  12. $query = mysql_query("SELECT * FROM members WHERE username='$username'");
  13.  
  14. $numrows = mysql_num_rows($query);
  15.  
  16. if ($numrows!=0)
  17. {
  18.  
  19. while ($row = mysql_fetch_assoc($query))
  20. {
  21. $dbusername = $row['username'];
  22. $dbpassword = $row['password'];
  23.  
  24. }
  25. if ($username==$dbusername&&$password==$dbpassword){
  26. if (!$row['banned'])
  27. {
  28. $_SESSION['username'] = $username;
  29. echo "Welcome , ".$_SESSION['username']." Enter the <a href='members.php'>members</a> page now <a href='changepassword.php'>Change password</a>";
  30.  
  31.  
  32. }
  33. else
  34. {
  35. header("Location: banned.php");
  36. }
  37.  
  38. }
  39. else
  40. {
  41. echo "Incorrect Password!";
  42. }
  43. }
  44. else
  45. {
  46. die("That user doesn't exist!");
  47.  
  48. }
  49. }
  50. else
  51. {
  52. die("Please enter a username and password");
  53. }
  54.  
  55. ?>
Add Comment
Please, Sign In to add comment