Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. $username = $_POST['username'];
  6. $password = $_POST['password'];
  7.  
  8. if ($username&&$password )
  9. {
  10.  
  11. $connect = mysql_connect ("localhost","root","") or die ("Couldn't connect to server");
  12. mysql_select_db("assessment2") or die ("Couldn't connect to server");
  13.  
  14. $query = mysql_query ("SELECT * FROM customers WHERE username = '$username'");
  15.  
  16. $numrows = mysql_num_rows ($query);
  17.  
  18. if ($numrows!=0)
  19. {
  20.  
  21. while ($row = mysql_fetch_assoc($query))
  22. {
  23. $dbusrename = $row['username'];
  24. $dbpassword = $row['password'];
  25. }
  26.  
  27. //check for match
  28.  
  29. if ($username==$dbusername&&$password==$dbpassword)
  30. {
  31.  
  32. }
  33. else
  34. echo "incorrect password";
  35.  
  36.  
  37.  
  38. }
  39. else
  40. die ("That username doesn't exist");
  41.  
  42. }
  43.  
  44.  
  45.  
  46. else
  47. die("Please enter a Username and Password!");
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement