daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Oct 23rd, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. session_start();
  4.  
  5. if (isset($_SESSION['username']))
  6. echo "You are logged in as $username";
  7.  
  8.  
  9. $username = $_POST['username'];
  10. $password = $_POST['password'];
  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. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top