| | |
Cookies and session are not working on my server for the index page
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2009
Posts: 33
Reputation:
Solved Threads: 1
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:
this is the logout, It used to work on other servers ok.
This is how I check if the cookie is set:
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
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:
php Syntax (Toggle Plain Text)
setcookie('id',$username,time()+3600);
this is the logout, It used to work on other servers ok.
php Syntax (Toggle Plain Text)
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:
php Syntax (Toggle Plain Text)
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
Last edited by theighost; Mar 30th, 2009 at 6:38 pm.
![]() |
Similar Threads
- How to configure GD (PHP)
- php.ini confusion (PHP)
Other Threads in the PHP Forum
- Previous Thread: stuck with the sql element convert to string problem
- Next Thread: MySQL efficiency
| Thread Tools | Search this Thread |
301 apache api array autosuggest beginner binary broken cakephp checkbox class cms code compression cron curl data database date display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google href htaccess html httppost if...loop image include insert ip javascript joomla jquery key library limit link links login mail md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search searchbox server session sessions sms sorting source space sql syntax system table tutorial update upload url validator variable video volume votedown web website youtube zend





