I am using following PHP function to do login and add session while login. I want my session to be automatically end after 30 minutes. Any suggestions out there ?
public function doLogin($uname,$upass)
{
    try
    {
        $stmt = $this->conn->prepare("SELECT user_id, user_name, user_pass FROM users WHERE user_name=:uname");
        $stmt->execute(array(':uname'=>$uname));
        $userRow=$stmt->fetch(PDO::FETCH_ASSOC);
        if($stmt->rowCount() == 1)
        {
            if(password_verify($upass, $userRow['user_pass']))
            {
                $_SESSION['user_session'] = $userRow['user_id'];
                return true;
            }
            else
            {
                return false;
            }
        }
    }
    catch(PDOException $e)
    {
        echo $e->getMessage();
    }
}
 
    