Advertisement
Guest User

Untitled

a guest
May 12th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2.  
  3. // obtaining login info
  4. require("info.php");
  5.  
  6. // connecting to server
  7. $connect = mysql_connect("$host","$user","$pass");
  8. if (!$connect){
  9. die('Could not connect to server: ' . mysql_error());
  10. }
  11.  
  12. // selecting database
  13.  
  14. //mysql_select_db($database, $connect);
  15.  
  16. if (!mysql_select_db($database, $connect)){
  17. die('Unable to select database: ' . mysql_error());
  18. }
  19.  
  20. // obtaining user input
  21.  
  22. $input_username = mysql_real_escape_string($_POST["username"]);
  23. $input_password = md5(mysql_real_escape_string($_POST["password"]));
  24.  
  25. // checking user input versus records
  26.  
  27. $stored_password = mysql_fetch_assoc(mysql_query("SELECT password FROM
  28. users WHERE username = \"$input_username\"));
  29.  
  30. if(!$stored_password){
  31. die('Unable to select table: '. mysql_error());
  32. }
  33.  
  34. if ($stored_password != $input_password){
  35. print'The password does not match, please try again';
  36. }
  37.  
  38. else{
  39. session_start();
  40. print'U bent nu ingelogd';
  41. mysql_close($connect);
  42. }
  43.  
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement