I set cookie when user login, and destroy it when user logout. like following code:

login:
set("cookie_email",$user_email,time()+3600);
set("cookie_md5password",$user_md5password,time()+3600);

logout:
set("cookie_email");
set("cookie_md5password");

I also have a function to check if user if login or not:
function check_inp_login_by_cookie() {
global $HTTP_COOKIE_VARS;
if ( isset($HTTP_COOKIE_VARS) ) {
if ( isset($HTTP_COOKIE_VARS["cookie_email"]) ) {
if ( isset($HTTP_COOKIE_VARS["cookie_md5password"]) ) {
return 1;
} else {
return 0;
}
}
}
return 0;
}


But in my login.php and logout.php, there must be some thing wrong:

loing.php:
#login start
set("cookie_email",$user_email,time()+3600);
set("cookie_md5password",$user_md5password,time()+3600);

if ( check_inp_login_by_cookie() ) {
echo "welcome";
} else {
echo "unwelcome";
}

surprising, it echo unwelcome.

?? help!

------------------
Good Good Study
Day Day Up