Advertisement
Guest User

Untitled

a guest
Oct 7th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?PHP
  2. session_start();
  3. include ("includes/config.php");
  4.  
  5. if ($_POST['submit'])
  6. {
  7. $username = strtolower($_POST['username']);
  8. $password = md5($_POST['password']);
  9.  
  10. if ($username && $password)
  11. {
  12.  
  13. $sql = mysql_query("SELECT username, password FROM Users WHERE username = '$username'") or die mysql_error();
  14. while ($row = mysql_fetch_array($sql))
  15. {
  16. $dbuser = $row['username'];
  17. $dbpass = $row['password'];
  18.  
  19. if(($dbuser == $username) && ($dbpass == $password))
  20. {
  21. $_SESSION['username'] = $dbuser;
  22. header('Location: home.php');
  23. }
  24. }
  25. }
  26. else
  27. {
  28. die("Please fill in the username and password");
  29. }
  30.  
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement