Cookies and session are not working on my server for the index page

Reply

Join Date: Jan 2009
Posts: 33
Reputation: theighost is an unknown quantity at this point 
Solved Threads: 1
theighost theighost is offline Offline
Light Poster

Cookies and session are not working on my server for the index page

 
0
  #1
Mar 30th, 2009
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:
  1. setcookie('id',$username,time()+3600);

this is the logout, It used to work on other servers ok.
  1. setcookie('id','',time()-3600);
  2. require_once("header.php");
  3. require_once("logout.php");
  4. require_once("footer.php");

This is how I check if the cookie is set:

  1. if(!isset($_COOKIE['id']))
  2. {
  3. echo "Sign In";
  4. }
  5. else
  6. {
  7. echo "Sign Out";
  8. }

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
Last edited by theighost; Mar 30th, 2009 at 6:38 pm.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 33
Reputation: theighost is an unknown quantity at this point 
Solved Threads: 1
theighost theighost is offline Offline
Light Poster

Re: Cookies and session are not working on my server for the index page

 
0
  #2
Mar 31st, 2009
Please can anyone give me an idea?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC