Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2.  
  3. include_once 'database_connect.php';
  4.  
  5. function validateUser($username, $pw)
  6. {
  7. $pw = mysql_real_escape_string($pw);
  8. $username = mysql_real_escape_string($username);
  9. $hashed_pass = md5($pw);
  10. $query = "select * from users where username = '$username' and pass = '$hashed_pass'";
  11. echo $query;
  12.  
  13. // comment the next line back in when database is up
  14.  
  15. $result = mysql_query($query);
  16. echo mysql_num_rows($result);
  17. if(mysql_num_rows($result) != 1)
  18. {
  19. echo "<br/>ERROR: Invalid username and/or password, please re-enter your username and password.";
  20. }
  21. else
  22. {
  23. session_start();
  24. $_SESSION["username"] = $username;
  25. //$_SESSION["uid"] = $
  26. }
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement