Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 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","root","")or die("Could Not connect");
  12. $db = mysql_select_db ("accounts") or die ("Could not find Database");
  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. if ($username==$dbusername&&$password==$dbpassword)
  28. {
  29.  
  30. echo "you're in! <a href='member.php'>Click</a> here to enter the member page.";
  31. $_SESSION['username']=$username;
  32. }
  33. else
  34. echo "Incorrect Password!";
  35.  
  36.  
  37. }
  38. else
  39. die("That user doesn't exist!");
  40.  
  41.  
  42.  
  43. }
  44. else
  45. die("Please Enter a username and a password!");
  46.  
  47.  
  48.  
  49.  
  50.  
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement