Guest User

Untitled

a guest
Nov 23rd, 2017
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public function Login($email, $password)
  2. {
  3. $stmt = $this->pdo->prepare("SELECT user_id from users where email = :email AND password = :password");
  4. $stmt->bindParam(":email", $email, PDO::PARAM_STR);
  5. $stmt->bindParam(":password", $password, PDO::PARAM_STR);
  6. $stmt->execute();
  7.  
  8. $user = $stmt->fetch(PDO::FETCH_OBJ);
  9. $count = $stmt->rowCount();
  10.  
  11. if($count >0){
  12. $_SESSION['user_id'] = $user->user_id;
  13. header('Location:home.php');
  14. }else{
  15. return false;
  16. }
  17. }
Add Comment
Please, Sign In to add comment