daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Sep 4th, 2018 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $username = $_POST['lusername'];
  2. $password = $_POST['lpassword'];
  3. $query = $connect->prepare("SELECT * FROM users WHERE username='$username'");
  4. // $query->bindParam(':username',  $username);
  5. $query->execute(array($username));
  6. $execute = $query->fetch();
  7. $id = $execute[id];
  8. if ($execute == 0) {
  9.     $_SESSION['message'] = "User with that email or username doesn't exist";
  10.     header("location: error.php");
  11. }
  12. if (password_verify($_POST['lpassword'], $execute['password'] ) ) {
  13.     function userislogged() {
  14.         $_SESSION['logged_in'] = true;
  15.         return $_SESSION['logged_in'];
  16.     }
  17.     $_SESSION['id'] = $id;
  18.     header("location: dashboard.php");
  19. } else {
  20.     $_SESSION['message'] = 'Cannot verify password.';
  21.     header("location: error.php");
  22. }
  23.    
  24. session_start();
  25. session_regenerate_id();
  26. if (!userislogged == true) {
  27.     $_SESSION['message'] = "You must be logged in to use this section";
  28.     header("location: error.php");
  29. } else {
  30.     $email = $_SESSION['email'];
  31.     $id = $_SESSION['id'];
  32. }
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