Guest User

Untitled

a guest
Oct 24th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <?php
  2.  
  3. include ("index.htm");
  4.  
  5. session_start();
  6.  
  7. $username = $_POST['username'];
  8. $password = $_POST['password'];
  9.  
  10.  
  11.  
  12. if ($username&&$password)
  13. {
  14.  
  15. $connect = mysql_connect("localhost","b3fantastico","password") or die("Could not connect to database");
  16. mysql_select_db("example") or die ("Could not find Database");
  17.  
  18. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  19.  
  20. $numrows = mysql_num_rows($query);
  21.  
  22. if ($numrows!=0)
  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&&md5 ($password==$dbpassword))
  32. {
  33. echo 'Successfully Logged in! <a href="member.php">Click here to enter the member page! </a>';
  34. $_SESSION['username']=$username;
  35.  
  36. }
  37. else
  38. echo "Incorrect Password!";
  39.  
  40. }
  41. else
  42. die("That user does not exist!");
  43.  
  44. }
  45.  
  46. else
  47. die("Please enter a username and a password");
  48.  
  49.  
  50. $_SESSION['id'] $_SESSION['username'] $_SESSION['password'] $_SESSION['email']
  51.  
  52. ?>
Add Comment
Please, Sign In to add comment