if (isset ($last))
{
$change = time () - $last;
if ( $change > 86400)
{
echo "Welcome back! <br> You last visited on ". date("m/d/y",$last) ;
// Tells the user when they last visited if it was over a day ago
}
else
{
echo "Thanks for using our site!";
//Gives the user a message if they are visiting again in the same day
}
}
This code first checks if $last is set. If you remember from the last step, $last is the time the visitor was last at the site. If they have visited before it then runs through two options. If the visitor has visited within the last day, it simply thanks them for visiting the site. If however the visitor visited over 1 day (86,400 seconds) ago, the message welcomes them back and reminds them of when they last visited.