newbie simple problem with cookie
- From: "David Graham" <david.graham18@xxxxxxxxxxxx>
- Date: Wed, 29 Mar 2006 12:29:56 GMT
Hi
Why does my cookie not get set?
I just get "Your last visit was - " and nothing else
thanks
Dvaid Graham
<?php
//Calculate 60 days in the future
//seconds * minutes * hours * days + current time
$inTwoMonths = 60 * 60 * 24 * 60 + time();
setcookie(lastVisit, date("G:i - m/d/y"), $inTwoMonths);
?>
<?php
if(isset($_COOKIE['lastVisit'])) // i.e. the cookie has not expired (2
months gone by)
$visit = $_COOKIE['lastVisit'];
else
echo "You've got some stale cookies!";
echo "Your last visit was - ". $visit;
?>
.
- Follow-Ups:
- Re: newbie simple problem with cookie
- From: Martin Jay
- Re: newbie simple problem with cookie
- From: David Graham
- Re: newbie simple problem with cookie
- Prev by Date: Re: Apache / PHP/ MySQL - user limits
- Next by Date: Re: newbie simple problem with cookie
- Previous by thread: Apache / PHP/ MySQL - user limits
- Next by thread: Re: newbie simple problem with cookie
- Index(es):
Relevant Pages
|