Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2.   require_once("includes/config.php");
  3.   require_once("includes/functions.php");
  4.  
  5.   $username = $_POST["username"];
  6.   $password = $_POST["password"];
  7.  
  8.   $user = findUser($username);
  9.  
  10.   if(count($user) > 1){
  11.      exit("You have duplicate username in your table");
  12.   }
  13.  
  14.   // var_dump($user);
  15.   // echo !password_verify($password, $user[0]["password"]);
  16.   // exit;
  17.  
  18.   if(count($user) === 0 || !password_verify($password, $user[0]["password"])){
  19.     exit("Username or Password is unvalid");
  20.   }
  21.  
  22.   $user = $user[0];
  23.  
  24.   if(loginUser($user)){
  25.     echo "User is logged in";
  26.   }
  27.   else {
  28.     echo "Couldn't log in user";
  29.   }
  30.  ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement