Guest User

Untitled

a guest
Nov 1st, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 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. if ($username&&$password)
  12. {
  13.  
  14. include 'forum/connect.php';
  15.  
  16. $query = mysql_query("SELECT * FROM users WHERE username='$username'");
  17. $numrows;
  18. $numrows = mysql_num_rows($query);
  19. echo 'num rows: ' . $numrows . ' mysql_error . ' . mysql_error(); die();
  20.  
  21. if ($numrows!=0)
  22. {
  23. while ($row = mysql_fetch_assoc ($query))
  24. {
  25. $dbusername = $row['username'];
  26. $dbpassword = $row['password'];
  27. }
  28.  
  29. // Check to see if they match!
  30. if ($username==$dbusername&&md5 ($password==$dbpassword))
  31. {
  32. echo 'Successfully Logged in! <a href="member.php">Click here to enter the member page! </a>';
  33. $_SESSION['username']=$username;
  34. $_SESSION['id'] = $row['id']; $_SESSION['username'] = $row['username']; $_SESSION['password'] = $row['password']; $_SESSION['email'] = $row['email'];
  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. ?>
Add Comment
Please, Sign In to add comment