07-02-2011, 06:12 PM
|
#5 (permalink)
|
|
The Acquainted
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
|
why not just drop a cookie, and check it every visit ?
http://www.tizag.com/phpT/phpcookies.php
Just use different times, some examples below
Code:
$sixhours = 21600 + time(); // current time + 6 hours
$halfday= 42300 + time(); // current time + 12 hours
$fullday = 86400 + time(); // current time + 24 hours
setcookie('lastVisit', date("G:i - m/d/y"), $sixhours);
I'd be tempted to set it at 6 or 12 hours, the cookie will expire, so if you test for it's existence and it's not there you can show your page.
So the code is shown here the wrong way round as you would test for the cookies existence first, then set it at the end of your page.
Code:
<?php
if(isset($_COOKIE['lastVisit']))
$visit = $_COOKIE['lastVisit'];
else
echo "You've got some stale cookies!";
echo "Your last visit was - ". $visit;
?>
__________________
Thanks... Simon
Sex, Drugs & Linux Rules
Last edited by maeltar : 07-02-2011 at 06:44 PM.
|
|
|