You are here: newbie simple problem with cookie « All PHP « IT news, forums, messages
newbie simple problem with cookie

Posted by David Graham on 03/29/06 15:29

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;
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация