Guest User

Untitled

a guest
Nov 1st, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 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.  
  18. $numrows = mysql_num_rows($query);
  19.  
  20. if ($numrows!=0)
  21. {
  22.  while ($row = mysql_fetch_assoc ($query))
  23.   {
  24.         $dbusername = $row['username'];
  25.         $dbpassword = $row['password'];
  26.   }
  27.  
  28.  // Check to see if they match!
  29.  if ($username==$dbusername&&md5 ($password==$dbpassword))
  30.   {
  31.      echo 'Successfully Logged in! <a href="member.php">Click here to enter the member page! </a>';
  32.      $_SESSION['username']=$username;
  33.      $_SESSION['id'] = $row['id']; $_SESSION['username'] = $row['username']; $_SESSION['password'] = $row['password']; $_SESSION['email'] = $row['email'];
  34.  
  35.  }
  36.   else
  37.       echo "Incorrect Password!";
  38.  
  39.  }
  40. else
  41.     die("That user does not exist!");
  42.  
  43. }
  44.  
  45. else
  46.     die("Please enter a username and a password");
  47.  
  48.    
  49. ?>
Add Comment
Please, Sign In to add comment