View Single Post
Old 12-08-2007, 07:02 AM   #7 (permalink)
iisbum
The Wanderer
 
Join Date: Nov 2007
Posts: 20
Thanks: 1
iisbum is on a distinguished road
Default

PHP Code:

if(!isset($_COOKIE['last_displayed'])) {
  
setcookie('last_displayed'"1"0'/');
} else {
  if (
$_COOKIE['last_displayed'] == "1") {
    
setcookie('last_displayed'date("Y-m-d h:i:s"), time() + (24 3600), '/');
    echo 
'Show Advert';
  } 

Basically you set the cookie on the first pageview to a control value, say 1, and to expire at the end of the current session, so if the user leaves the site after that first pageview if they comeback later that day they will again see the ad on the 2nd pageview.

If the cookie is set to 1, show the ad and set to another value, with an expiry in 24 hours.

Mubs
iisbum is offline  
Reply With Quote
The Following User Says Thank You to iisbum For This Useful Post:
Sled (12-14-2007)