You can only use $_COOKIE
.
You can set the values to a $_COOKIE
like this:
setcookie("loginCredentials", $user, time() * 7200); // expira depois de 2 hours
To get around you can just leave the cookie value blank like this:
setcookie("loginCredentials", "");
And finally to verify that the user is logged in:
if(isset($_COOKIE['user']['id'] && !empty(isset($_COOKIE['user']['id']))){
// Usuário logado.
}else{
// Usuário não esta logado.
}
This variable $user
could look something like this:
$user = array(
'id' => $id,
'name' => $name,
'login' => $login,
)
Just be careful not to leave passwords and information unprotected.