Hey,
I have a login script which saves a user token in a session variable and in a cookie. At each page request it checks if the token exists in a database, if it does, then the information of the user with that token is saved in the array $login_data ( for example $login_data ).
I use the following logout function:
PHP Code:
function logout(){
// session_start() has allready been called.
global $login_data;
$expire = mktime(12,0,0,1, 1, 1970);
// remove login data
unset( $login_data );
// make the cookies expire
setCookie('ck_admin_token', '', $expire, '/' );
// unet and destroy session variables.
session_unset();
session_destroy();
}
When i run the logout function on my home machine it works perfectly, but when i upload the website to my paid host it doesn’t work anymore. I think it is the cookie that won’t expire.
Can anyone help me out?
Thanks in advance.