Unstoppable Domains โ€” Get your daily AI drops report

Random add Script

NamecheapNamecheap
Watch
Hi,

If you want a copy its nice and easy in php, just put where you want the ads to appear:
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); 
?>

Thanks and enjoy.

p.s (I Like rep :hehe:)
 
1
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
And if you want FlatDB, I just wrote this.

In your DB file, put:
Code:
http://www.hi.com||http://www.hi.com/hi.png
http://www.hi2.com||http://www.hi2.com/hi.png

The php:
PHP:
<?
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];
?>
 
0
•••
That's a pretty useful script, I'll use it everywhere! :)

Added Random Ad Sizes.
PHP:
<?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"; $imgwidth="88"; $imgheight="31"; break; 
case 2 : $banner="site 2 image url"; $url="site two address"; $imgwidth="50"; $imgheight="50"; break; 
case 3 : $banner="site 3 image url"; $url="site 3 address"; $imgwidth="468"; $imgheight="60"; break; 
} 
$display = "<a href=\"$url\" target=\"_blank\"> "; 
$display.= "<img src=\"$banner\"  "; 
$display.= "width=\"$imgwidth\" height=\"$imgheight\" border=\"0\" >"; 
$display.="</a>"; 
echo($display); 
?>
 
Last edited:
0
•••
I could have added the sizes, ill do that on the next version that comes, out, cvxdes, i dont see what you are trying to do, break into my thread, mine is just a flat db, no mysql or anything involved.
 
0
•••
nice script, rep is coming your way.
 
0
•••
Oh, thanks! Its a script i needed to do something then when i learnt php, everyone is liking it.
 
0
•••
Very nice, was looking for something like this a while ago :D..!
 
0
•••
Simply basic but applicable to any object with modifications. Thanks. ;)
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
CatchedCatched
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back