Re: Cookies are being created each visit to the web site

From: Date: Tue, 06 Nov 2001 17:20:31 +0000
Subject: Re: Cookies are being created each visit to the web site
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-73617@lists.php.net to get a copy of this message
Check your clock time against server clock. time()+15724800 means "server time + X seconds" while the death of a cookie is done using client time. :-) Byez "Sam" <Sam@dragoman.co.uk> ha scritto nel messaggio news:478EB6C82CC2D4119AF300B0D07963F4115E2C@NTSERVER01... > Hi all, > > I have this strange problem, > I set a cookie on the first page on the web site. > It all works fine through out the site, as this cookie is called throughout. > Until I close the browser window and open a new one. > I go back to the site, and for some reason I need to set the cookie again. > > > Here is the code > > $ID=md5 (uniqid (rand())); > setcookie ("cookie_country", "uk","time()+15724800"); > mysql_query("INSERT INTO client VALUES('', '$ID', > '','','','','','','','','','','','','','','','','','','','','','','null','') > ;")or die("No insert"); > $getClientID=mysql_query("SELECT clientID FROM client WHERE > uniqueID='$ID'")or die("unable to get the client ID"); > $clientID=mysql_fetch_row($getClientID); > setcookie ("client", $clientID[0],"time()+15724800"); > print "<HTML><HEAD><meta HTTP-EQUIV=\"Refresh\" > CONTENT=\"0; > url=$pageGoTo\"></head></html>"; > > > as when I open the new window, the code that first is used is this... > > if (isset($cookie_country)) > { > code > } > > $cookie_country is the cookie set previously, but this doesn't seem to have > been stored. > > I have checked settings and cookies are enabled. > > Can anyone shed some light on this? > > Thanks > Sam > > p.s. Also I'm only on the digest, so if you could reply directly to me as > well, that would be a bonus. >

« previous php.general (#73617) next »