Hello,

I have a bit of a problem, I am think its not the script that has the problem, but wanted to be sure before contacting the server masters.

In my website, I can make cookies, and sessions, I can echo them successfully.

But when I logout, it doesn't work,

Lets take the cookie example:

I set the cookie like:

setcookie('id',$username,time()+3600);

this is the logout, It used to work on other servers ok.

setcookie('id','',time()-3600);
require_once("header.php");
require_once("logout.php");
require_once("footer.php");

This is how I check if the cookie is set:

if(!isset($_COOKIE['id']))
{
echo "Sign In";
}
else
{
echo "Sign Out";
}

when I check if the cookie is there, it has this strange attitude.
After I login and make the cookie, no errors appear when I surf through the site's pages. (the 'sign out' button appears)

when I logout, I can surf the site with no problems (the 'Sign in' button appears), but at the index page still its writing ('Logout') giving the fact the I am using the same header file for all the pages.

One more detail (take a look at the logout code): when I logout I still get the 'Sign out' button appearing. for the first time giving the fact that I clear the cookie before echoing the header. but If I refresh the logout page again right after logging out the first time I get the 'Sign in' button again.

what is happening? and what is the problem with the index, is it the php.ini file? should I contact the server masters?

Thanks

Please can anyone give me an idea?

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.