Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 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. $connect = mysql_connect("****", "****", "****") or die("could not connect to mysql");
  11. mysql_select_db("****") or die("could not connect to db");
  12. }
  13.  
  14. $query = mysql_query("SELECT * FROM members 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. echo ('you\'re in, click <a href="#">here</a> to enter your profile');
  30. $_SESSION['username']=$username; 
  31. }
  32. else
  33. {
  34. echo ("please enter your username and password");
  35. }
  36.  
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement