Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2. include("header.php");
  3. ?>
  4. <body>
  5. <?php
  6. $username = mysql_real_escape_string($_POST['username']);
  7. $password = $_POST['password'];
  8.  
  9.  
  10. if ($username&&$password)
  11. {
  12.  
  13.  
  14.  
  15. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  16.  
  17. $numrows = mysql_num_rows($query);
  18.  
  19. if ($numrows!=0)
  20. {
  21. while ($row = mysql_fetch_assoc($query))
  22. {
  23. $dbusername = $row['username'];
  24. $dbpassword = $row['password'];
  25. }
  26.  
  27. // check to see if they match!
  28. if ($username==$dbusername&&$password==$dbpassword)
  29. {
  30. echo "Welcome back, $username";
  31. $user = ($_SESSION['user']);
  32. $_SESSION['user']=$username;
  33. }
  34. else
  35. echo "Incorrect password!";
  36.  
  37. }
  38. else
  39. die("That User Doesn't exist!");
  40.  
  41.  
  42.  
  43. }
  44. else
  45. die("Please enter a username and a password.");
  46.  
  47.  
  48.  
  49. ?>
  50.  
  51. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement