Jump to content
xisto Community
Sign in to follow this  
iGuest

session n setcookie prob

Recommended Posts

Hi, i've probs in setting cookies n sessions. When i set them on one pg, it somehow doesn't appear on other pgs i.e. e variables r empty. But thr doesn't seem to b anything wrong wif e code cos previously, it was working on another host. Can any1 pls help me? Thank you!TESTCOOKIE1.php<?phpif(!session_start())session_start();$name="he";setcookie("uname", $name, time()+36000);setcookie("PHPSESSID",session_id(),time()+3600);session_register ("test_S");$HTTP_SESSION_VARS ["test_S"] = "testvalue";?> <html><body><a href="http://forums.xisto.com/no_longer_exists/ pg</a></body></html>TESTCOOKIE2.PHP<?phpif(!session_start())session_start();echo ("$test_S");if (isset($_COOKIE["uname"]))echo "Welcome " . $_COOKIE["uname"] . "!<br />";elseecho "You are not logged in!<br />";if (isset($_COOKIE["PHPSESSID"]))echo "Welcome " . $_COOKIE["PHPSESSID"] . "!<br />";elseecho "You are not logged in!<br />";?><html><body></body></html>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.