Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function loggingIn(){
- if(!empty($this->m_sUsername) && !empty($this->m_sPassword)){
- $PDO = Db::getInstance();
- $stmt = $PDO->prepare("SELECT * FROM users WHERE username = :username");
- $stmt->bindValue(":username", $this->m_sUsername, PDO::PARAM_STR);
- $stmt->execute();
- if($stmt->rowCount() > 0){
- $result = $stmt->fetch(PDO::FETCH_ASSOC);
- $password = $this->m_sPassword;
- $hash = $result['password'];
- if(password_verify($password, $hash)){
- session_start();
- $_SESSION["loggedIn"] = $result['usersid'];
- session_write_close();
- return true;
- }else{
- return false;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment