paffley
01-07-2012, 12:23 AM
I have this piece of code but its not working for me and cannot find the answer as im currently learning php...
the code should show when I/user last visited the website with a cookie set, heres what i have...
<?php
if(isset($_COOKIE['LastVisit']))
{
$last = $_COOKIE['LastVisit'];
}
$year = 31536000 + time() ;
setcookie(LastVisit, time (), $year) ;
if (isset ($last))
{
$change = time () - $last;
if ( $change > 86400)
{
echo "Last visit was". date("m/d/y",$last) ;
}
?>
Any help is hugely appreciated.
Kind regards,
paffley
the code should show when I/user last visited the website with a cookie set, heres what i have...
<?php
if(isset($_COOKIE['LastVisit']))
{
$last = $_COOKIE['LastVisit'];
}
$year = 31536000 + time() ;
setcookie(LastVisit, time (), $year) ;
if (isset ($last))
{
$change = time () - $last;
if ( $change > 86400)
{
echo "Last visit was". date("m/d/y",$last) ;
}
?>
Any help is hugely appreciated.
Kind regards,
paffley