Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start();
- require_once('config.php');
- // Retrieve username and password from database according to user's input
- $input_username = mysql_real_escape_string($_POST['username']);
- $login = mysql_query("SELECT * FROM user WHERE username = '".$input_username."'" );
- $sql = "UPDATE user SET logindate = NOW() WHERE username = '" . mysql_real_escape_string($_SESSION['username']) . "'";
- // Check username and password match
- $row = mysql_fetch_array($login);
- if (mysql_num_rows($login)) {
- if($row['password'] === md5($_POST['password'])){
- $_SESSION['username'] = $_POST['username']; // store in session
- echo header('Location: loginerror.php');
- exit;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement