Hi,
Any ideas on how to tweak the script at
http://php.about.com/od/finishedphp1/ss/last_visit.htm
to pull the users name from the viart database so that you could say Welcome Back John i.e Welcome Back 'Registered Users Firstname'.
Would be nice to personalise the shopping experience like amazon and ebay etc... do it.
Thanks
code
<?php
if(isset($_COOKIE['AboutVisit']))
{
$last = $_COOKIE['AboutVisit']; }
$year = 31536000 + time() ;
//this adds one year to the current time, for the cookie expiration
setcookie(AboutVisit, time (), $year) ;
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
}
}
else
{
echo "Welcome to our site!";
//Greets a first time user
}
?>