Thread: IF Visited
View Single Post
Old 01-12-2013, 09:45 PM   PM User | #5
peteyshivery
New Coder

 
Join Date: Dec 2011
Posts: 11
Thanks: 5
Thanked 0 Times in 0 Posts
peteyshivery is an unknown quantity at this point
Quote:
Originally Posted by Fou-Lu View Post
You can do that in PHP, I just don't know why you wouldn't use the JS anyway since its required to show the code.
PHP Code:
<?php

$iDuration 
5;

$bShowIt = !isset($_COOKIE['lastShown']) || isset($_COOKIE['lastShown']) && (time() - $_COOKIE['lastShown']) > $iDuration true false;

if (
$bShowIt)
{
    
setcookie('lastShown'time(), time() + $iDuration);
    
// do whatever you gotta do to show it
    
printf('Show something every %d seconds'$iDuration);
}
Looks like it'd do the trick. Server languages tend to limit their reliance on cookies as much as they can.
Fou, thank you so much for this, it works great! The iDuration is per seconds right?
peteyshivery is offline   Reply With Quote