Advertisement
Guest User

Untitled

a guest
Oct 29th, 2018
163
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if ( count($errors) == 0 )
  2.       {
  3.           $password = md5($password);
  4.           $query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
  5.           $results = mysqli_query($db, $query);
  6.           if ( mysqli_num_rows($results) == 1 )
  7.           {
  8.               $_SESSION['username'] = $username;
  9.               $db = mysqli_connect('localhost', 'root', '', 'registration');
  10.               $date = date('Y-m-d H:i:s');
  11.               mysqli_query($db,"UPDATE users(lastlogin) VALUES ('$date')");
  12.               $_SESSION['success'] = "You are now logged in";
  13.               header('location: index.php');
  14.           }
  15.           else
  16.           {
  17.               array_push($errors, "Wrong username/password combination");
  18.           }
  19.       }
Advertisement
RAW Paste Data Copied
Advertisement