Posted by David Graham on 03/29/06 15:34
"David Graham" <david.graham18@ntlworld.com> wrote in message
news:85vWf.38278$u31.10281@newsfe2-win.ntli.net...
> 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;
> ?>
>
>
Added an extra line but I get the same output on screen as before!
<?php
if(isset($_COOKIE['lastVisit'])) { // i.e. the cookie has not expired (2
months gone by)
echo "does this line print";
$visit = $_COOKIE['lastVisit'];
}
else
echo "You've got some stale cookies!";
echo "Your last visit was - ". $visit;
?>
Navigation:
[Reply to this message]
|