Advertisement
Guest User

Untitled

a guest
Jun 14th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. if (isset($_POST['username']))
  5. {
  6.  
  7. $username = $_POST['username'];
  8. $password = $_POST['password'];
  9.  
  10.  
  11.  
  12. $connect = mysql_connect("localhost","a26_flroot","plates123") or die("Couldn't Connect.");
  13. mysql_select_db("a26_flogin") or die("Couldn't connect.");
  14.  
  15. $select = "SELECT * FROM users WHERE username = '$username' AND password='$password'";
  16.  
  17. $query = mysql_query($select);
  18.  
  19. $numrows = mysql_num_rows($query);
  20.  
  21. if ($numrows==0)
  22. {
  23. /*
  24. while ($row = mysql_fetch_assoc($query))
  25. {
  26. $dbusername = $row['username'];
  27. $dbpassword = $row['password'];
  28. }
  29.  
  30. // check to see if they match!
  31. if ($username==$dbusername&&$password==$dbpassword)
  32. {
  33. */
  34. echo "Welcome back, <a href='/login/member.php'>$username</a>";
  35. setcookie('username',$username,time()+7200, '/');
  36.  
  37.  
  38.  
  39. /*
  40. }
  41. else
  42. echo "Incorrect password!";
  43. */
  44. }
  45. else
  46. die("That user doesnt exist!");
  47.  
  48.  
  49.  
  50. }
  51. else
  52. die("Please enter an username and password.");
  53.  
  54.  
  55.  
  56.  
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement