note 16944 deleted from function.setcookie by sniper

From: Date: Wed, 11 Dec 2002 07:19:40 +0000
Subject: note 16944 deleted from function.setcookie by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-40740@lists.php.net to get a copy of this message
I have finally gotten my cookies to work consistently. This has been tested on IE5+ and NS6. I use cookies to set parameters for each user. I am using session support via database and passing URLs with sessionID. I change the cookie by referencing another page via a HREF link. I suppose it could be done by calling the original page, and I plan to try that next. (IMA NEWBIE) Here is the link to the "setcookie" page: (print) "<A HREF=./setversion.php?&rv=$version_name&SESSION_ID=$SESSION_ID>$version_name</A>"; Here is the "setcookie" page: <? include "config.inc.php"; $expires = time()+(60*60*34*265*10); setcookie($VERSION_SELECTED, $rv, $expires); Header("Location: index.php"); exit; ?> Here is the config.inc.php page: <? $SITE_NAME = "SITENAME"; $COOKIE_PREFIX = "SITENAME"; $VERSION_SELECTED = $COOKIE_PREFIX."VERSION"; ?> IT SEEMS TO BE VERY IMPORTANT TO HAVE THE SITENAME URL AND THE COOKIE PREFIX SET TO IDENTICAL VALUES! IF YOU DONT'T HAVE THEM THE SAME, SETCOOKIE IS "BUGGY". TRY IT, YOU'LL LIKE IT! :) Mikey

« previous php.notes (#40740) next »