<?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>