Advertisement
Guest User

Untitled

a guest
Jul 8th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2. $username = $_POST['username'];
  3. $salt = md5($_POST['password']);
  4. $password = hash('sha1', $salt);
  5. $userinfo = mysql_query("SELECT * FROM `users` WHERE `username` = '$username'") or die(mysql_error());
  6. $userpass = mysql_query("SELECT * FROM `users` WHERE `password` = '$password'") or die(mysql_error());
  7. $check = mysql_num_rows($userinfo);
  8. $checkpass = mysql_num_rows($userpass);
  9. if($check == '0');
  10. {
  11.     echo "Sorry. You have entered the wrong username";
  12. }
  13. if($checkpass =='0');
  14. {
  15.     echo "Sorry. You have entered the wrong password";
  16. }
  17. $_SESSION['user'] = "$username";
  18. $_SESSION['password'] = "$password";
  19. echo "You are being logged... Please wait...";
  20. echo "Redirecting you...";
  21.  
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement