NameSilo

Creating Interstital Ad Pages

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

The Equivocate

Established Member
Impact
13
Since neither of my advertisers offer interstitial ad pages, I was considering having the page be server-side and just display some large box ads on the interstitial. How would I go about creating this? I need to be able to set the frequency (per hour/day) per visitor and there also needs to be a "Skip" feature just like other advertiser's IA pages. I looked on hotscripts.com and couldn't find anything like it.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
PHP:
<?php
if(isset($_COOKIE["shownad"]) && $_COOKIE["shownad"] == 1)
{
	header("Location: $url");
	exit();
}else{
	setcookie("shownad", "1", time()+1800);
}
?>
<script language="JavaScript">

<!--
var timer = 10;
var timerID = 0;
var tStart  = null;

function UpdateTimer() {
	if(timerID) {
      clearTimeout(timerID);
      timerID = setTimeout("UpdateTimer()", 1000);
   }
	if(timer == 1)
	{
		timer = timer - 1;
		document.getElementById('seconds').innerHTML = timer;
		document.location = '<?php echo $url; ?>';
		//do something
	}else{
		timer = timer - 1;
		document.getElementById('seconds').innerHTML = timer;
	}
	
}


function Stop() {
   if(timerID) {
      clearTimeout(timerID);
      timerID  = 0;
   }

   tStart = null;
}

function Reset() {
   tStart = null;

   document.getElementById('seconds').innerHTML = timer;
   timerID = setTimeout("UpdateTimer()", 1000);
}

//-->

</script>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<body onload="Reset()" onunload="Stop()">
<center>
The game is loading. There are <span id="seconds"></span> seconds left. (<a href="<?php echo $url; ?>">Skip loading</a>)<br><br>
Ad code here
</center>

An example can be seen here: http://www.gamedose.com/game_drivers_ed-325.html

Editing the code:
Change "var timer = 10;" to how many seconds you want to wait on the ad page.
Change "setcookie("shownad", "1", time()+1800);" to the number of seconds until the loading page is shown again. Set to 0 for ads to show every time.

Use:
if you save the file as loading.php, use the following url for loading the page:
http://www.yourdomain.com/loading.php?url=http://www.theurlyouwanttoloadafterthead.com

If a visitor uses the back button after the destination page loads, it comes back to the ad page. I don't know how to make it go back to the main page when users hit back.
 
0
•••
I was following until you got to the last paragraph about the loading.php and the URL on the end of it. I want it all to be dynamic, and if I'm linking to various news stories (which obviously are continually updated and the URLs change), wouldn't it not work?
 
0
•••
Anyone?
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back