Advertisement
Guest User

Untitled

a guest
Feb 12th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php session_start();
  2. require_once('config.php');
  3.  
  4. // Retrieve username and password from database according to user's input
  5. $input_username = mysql_real_escape_string($_POST['username']);
  6. $login = mysql_query("SELECT * FROM user WHERE username = '".$input_username."'" );
  7.  
  8. $sql = "UPDATE user SET logindate = NOW() WHERE username = '" . mysql_real_escape_string($_SESSION['username']) . "'";
  9.  
  10. // Check username and password match
  11. $row = mysql_fetch_array($login);
  12. if (mysql_num_rows($login)) {
  13.         if($row['password'] === md5($_POST['password'])){
  14.              $_SESSION['username'] = $_POST['username']; // store in session
  15.         echo header('Location: loginerror.php');
  16.               exit;
  17. }
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement