RE: [PHP] Simple Cookies not working
| From: | Sam | Date: | Wed, 10 Oct 2001 09:45:56 +0000 |
| Subject: | RE: [PHP] Simple Cookies not working | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70613@lists.php.net to get a copy of this message | ||
Cheers so far,
I'm not a 100% clear about sessions, can these be set so that they don't
expire like cookies?
Sam
-----Original Message-----
From: Thomas Buck [mailto:tom@localeyes-uk.com]
Sent: 10 October 2001 10:17
To: Sam; 'php'
Subject: Re: [PHP] Simple Cookies not working
I personally wouldn't bother with setting cookies by hand unless you have a
really good reason to.
Use the session functions instead.
e.g.
<?
session_start();
session_register("cookie_test");
if (isset($cookie_test)) {
echo "Yes and here it is ''$cookie_test";
} else {
$cookie_test = "Cookie Set";
echo "No, but it has now been set.";
}
?>
Thomas.
At 10:07 10/10/01 +0100, Sam wrote:
>Hi all, thanks for your help with my last problem...
>
>I have this code
>
><?
> if (isset($cookie_test))
> {
> print "YES and here it is '$cookie_test'";
> }
> else
> {
> setcookie ("cookie_test", "Cookie Set",time()+120);
> print "No, but it has now been set.";
> }
>?>
>
>This works on 98 PC's but not on win2000 PC's is this a PHP problem or an
OS
>problem?
>All the IE configurations are the same.
>
>Cheers
>Sam Rose
>
>p.s. Also I'm only on the digest, so if you could reply directly to me as
>well, that would be a bonus.