Conoscere quando è stata effettuata l’ultima visita dall’utente può essere molto utile.
Vediamo come realizzarla in PHP con l’utilizzo dei cookie.
< ?phpif(isset($_COOKIE['AboutVisit'])){$last = $_COOKIE['AboutVisit']; }$year = 31536000 + time() ;
//this adds one year to the current time, for the cookie expirationsetcookie(AboutVisit, time(), $year) ;
if(isset($last)){$change = time() - $last;
if($change > 86400){echo"Welcome back! 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}}else{echo"Welcome to our site!";
//Greets a first time user}?>
PhotoMontager è un sito dove è possibile creare semplici e divertenti fotomontaggi al volo a partire da una foto personale, in modo gratuito e senza richiedere registrazione.