Marco_4 0 Newbie Poster

Hello, how can I extend the login session in my class?

    public function login($username, $password){       
        $this->db->query("SELECT * FROM users WHERE username = :username LIMIT 1");
        $this->db->bind(':username', $username);
        $row = $this->db->single();
        $count = $this->db->rowCount();
            if ($count > 0) {
                if (password_verify($password, $row['password'])) {
                    $_SESSION['session'] = array(
                        'id' => $row['id'],
                        'username' => $row['username'],
                        'email' => $row['email'],
                        'gender' => $row['gender'],
                    );
                    return true;
                } else {
                    return false;
                }
            }
    }

Thank You

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.