A simple Ad rotate

Status
Not open for further replies.

gae89

Active Member
124
2015
9
0
Hello,
I need of a Adrotator for displayed 1 popup for 1 click.
I have saw this script:

<script language="JavaScript" type="text/javascript">
ads = new Array(5);
ads[0] = "<a href='AD URL' rel='nofollow'>" +
"<img src='IMAGE URL' border='0' height='90px' width='468px'/></a>";
ads[1] = "<a href='AD URL' rel='nofollow'>" +
"<img src='IMAGE URL' border='0' height='90px' width='468px'/></a>";
ads[2] = "<a href='AD URL' rel='nofollow'>" +
"<img src='IMAGE URL' border='0' height='90px' width='468px'/></a>";
ads[3] = "<a href='AD URL' rel='nofollow'>" +
"<img src='IMAGE URL' border='0' height='90px' width='468px'/></a>";
ads[4] = "<a href='AD URL' rel='nofollow'>" +
"<img src='IMAGE URL' border='0' height='90px' width='468px'/></a>";
index = Math.floor(Math.random() * ads.length);
document.write(ads[index]);
</script>

But How I can add the ad codes like this:
<script type="text/javascript">
var uid ='XXXXXX';
var wid ='XXXXXX';
</script>
<script type="text/javascript"src="http://popaddress.com/pop.js"></script>
 
3 comments
You could use the following very simple php code to rotate the ads and weight them.

PHP:
<?php 

 // random number 1 - 100     $result_random = rand(1, 100);    

 // if result less than or equal 70, display ad1 (70%) 
 if($result_random <= 70){ 
print "<script type="text/javascript">
var uid ='XXXXXX';
var wid ='XXXXXX';
</script>
<script type="text/javascript"src="popaddressdotcom/pop.js"></script>";  
}   

 // if result less than or equal 90, display ad2 (20%) 
  else if($result_random <= 90){ 
print "<script type="text/javascript">
var uid ='XXXXXX';
var wid ='XXXXXX';
</script>
<script type="text/javascript"src="popaddressdotcom/pop.js"></script>"; 
}   

// if result less than or equal 100, display ad3 (10%)  
  else { 
print "<script type="text/javascript">
var uid ='XXXXXX';
var wid ='XXXXXX';
</script>
<script type="text/javascript"src="popaddressdotcom/pop.js"></script>"; 
}  

 ?>
 
Status
Not open for further replies.
Back
Top