Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * @author Jason
  5. * @copyright 2010
  6. */
  7.  
  8. $username = $_POST['username'];
  9. $password = $_POST['password'];
  10.  
  11. if ($username&&$password)
  12. {
  13.  
  14. $connect = mysql_connect("localhost","root","jason") or die("Cannot connect to localhost!");
  15. mysql_select_db("usersystem") or die("Cannot connect to database!");
  16.  
  17. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  18.  
  19. $numrows = mysql_num_rows($query);
  20.  
  21. if ($numrows!=0)
  22. {
  23.  
  24. while($row = mysql_fetch_assoc($query))
  25. {
  26.  
  27. $dbusername = $row['username'];
  28. $dbpassword = $row['password'];
  29.  
  30. }
  31.  
  32. if ($username==$dbusername&&md5($password)==$dbpassword)
  33. {
  34.  
  35. echo "You're in!";
  36.  
  37. } else
  38. echo "Incorrect Password!";
  39.  
  40. } else
  41. die("Username doesn't exist!");
  42.  
  43. } else
  44. die("Enter a username and passoword!");
  45.  
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement