The login information can store in session or cookie. When store in session, the default expire time is when browser is closed.

Change the default by set the session.cookie_lifetime option in php.ini.

 
ini_set('session.cookie_lifetime'), 600); // 10 minutes
 

If you use cookie, the job will be much easier.

 
function Login( $name , $value , $persist = false) {
    if($persist)
        setcookie($name,$value,time()+60*60*24*100, "/");
    else
        setcookie($name,$value);
}
 
function Logout($name) {
    setcookie ($name, "",time()-60*60*24*100, "/");
}