NetworkTown.Net
Account Closed
- Impact
- 2


<?php
srand( microtime() * 1000000);
$advertise = rand(1,3);
//After the rand decided how many youve got and the first and last number e.g got 3, 1,3
switch($advertise)
//you can add more just use the same format
{
case 1 : $banner="site 1 image url"; $url="site one address"; break;
case 2 : $banner="site 2 image url"; $url="site two address"; break;
case 3 : $banner="site 3 image url"; $url="site 3 address"; break;
}
$display = "<a href=\"$url\" target=\"_blank\"> ";
$display.= "<img src=\"$banner\" ";
$display.= "width=\"468\" height=\"60\" border=\"0\" >";
$display.="</a>";
echo($display);
?>
webmonkey said:I have made you one:
Code:<?php srand( microtime() * 1000000); $advertise = rand(1,3); //After the rand decided how many youve got and the first and last number e.g got 3, 1,3 switch($advertise) //you can add more just use the same format { case 1 : $banner="site 1 image url"; $url="site one address"; break; case 2 : $banner="site 2 image url"; $url="site two address"; break; case 3 : $banner="site 3 image url"; $url="site 3 address"; break; } $display = "<a href=\"$url\" target=\"_blank\"> "; $display.= "<img src=\"$banner\" "; $display.= "width=\"468\" height=\"60\" border=\"0\" >"; $display.="</a>"; echo($display); ?>
http://www.hi.com||http://www.hi.com/hi.png
http://www.hi2.com||http://www.hi2.com/hi.png
<?
funtion ad_template($url, $img){
$ad = "<a href='".$url."'><img src='".$img."' alt=''/>";
return $ad;
}
$i = 0;
$lines = file('addb.txt');
foreach($lines as $line){
$i++;
$data = explode("||", $line);
$return[$i] = ad_template($data[0], $data[1]);
}
$number = rand(0,$i);
echo $return[$number];
?>
<?php
$fcontents = join ("", file ("banner_ads.txt"));
$s_con = split("~",$fcontents);
$banner_no = rand(0,(count($s_con)-1));
echo $s_con[$banner_no];
?>
YOUR FIRST AD CODE
~
YOUR SECOND AD CODE
~
YOUR THIRD AD CODE
~
etc.....

