Advertisement
Guest User

Untitled

a guest
Jun 14th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4.  
  5. $username = $_POST['username'];
  6. $password = $_POST['password'];
  7.  
  8. if ($username&&$password)
  9. {
  10.  
  11. $connect = mysql_connect("localhost","a26_flroot","plates123") or die("Couldn't Connect.");
  12. mysql_select_db("a26_flogin") or die("Couldn't connect.");
  13.  
  14. $query = mysql_query("SELECT * FROM users 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. $dbusername = $row['username'];
  24. $dbpassword = $row['password'];
  25. }
  26.  
  27. // check to see if they match!
  28. if ($username==$dbusername&&$password==$dbpassword)
  29. {
  30. echo "Welcome back, <a href='/login/member.php'>Member</a>";
  31. $_SESSION['username']==$dbusername;
  32. }
  33. else
  34. echo "Incorrect password!";
  35.  
  36. }
  37. else
  38. die("That user doesnt exist!");
  39.  
  40.  
  41.  
  42. }
  43. else
  44. die("Please enter an username and password.");
  45.  
  46.  
  47.  
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement