Random Image Link Script

Started on the old forum in November 2010 · view the original in the archive · old links redirect here

#advertising #banners #link-xchange #wap-scripts

3 replies · 758 views · started 16 years ago · 1 min read

2 participants
s3nzo Developer · 156 posts #1

Hey guys, here's one of my new php scripts i just coded and wanted to share with you, it shows random image link up to 5 random images but if you want more random image links you can contact me i will increase the number, the php code is :

<?php	

echo	'<style type="text/css">	
		.ads				
		{
		background-color:#eaeaae;
		}
		img
		{
		width:120px;
		height:30px;
		border:-1px;
		}
		a
		{
		color:red;
		font-weight:bold;
		text-decoration:none;
		}
		</style>';
echo	'<div class=\'ads\'>';
		$num	=	5; #Put the number of random links you want here, maximum is 5
		$ads	=	rand(1,$num);
#Please change links and banner addresses to suit your needs
		$ad1	=	'<a href=\'http://libra.wen.ru\'>
				<img src=\'banner1.gif\' alt=\'libra\'/></a>';
		$ad2	=	'<a href=\'http://s3nzo.wen.ru\'>
				<img src=\'banner2.gif\' alt=\'s3nzo.wen.ru\'/></a>';
		$ad3	=	'<a href=\'http://m-phone.info/?id=konvictmobi\'>
				<img src=\'banner3.gif\' alt=\'m-phone\'/></a>';
		$ad4	=	'<a href=\'http://wap.konvict.mobi/?id=konvictmobi\'>
				<img src=\'banner4.gif\' alt=\'konvict.mobi\'/></a>';
		$ad5	=	'<a href=\'http://bluechild.co.cc\'>
				<img src=\'banner5.gif\' alt=\'BlueChild\'/></a>';
		$s3nzo	=	'<a href=\'http://konvict.mobi\'>KONVICT.mobi</a>';
		$ad	=	'Powered by';
switch($ads)
	{
		case 1 : print $ad1.'<br>';
		break;
		case 2 : print $ad2.'<br>';
		break;
		case 3 : print $ad3.'<br>';
		break;
		case 4 : print $ad4.'<br>';
		break;
		case 5 : print $ad5.'<br>';
		break;
		default : print $s3nzo.'<br>';
	}

echo $ad.' '.$s3nzo.'</div>';

?>

The demo of the script can be found HERE and the full script with default banners is attached

Attachments: random_ads.zip
s3nzo Developer · 156 posts #2

I just created another version of this script! In this new version you can choose to show image ads, text ads or both types! hope you enjoy this new version, please open the file "randomized.php" and replace the code with this one

<?php	
echo	'<style type="text/css">	
		.ads				
		{
		background-color:#eaeaae;
		}
		img
		{
		width:120px;
		height:30px;
		border:-1px;
		}
		a
		{
		color:red;
		font-weight:bold;
		text-decoration:none;
		}
		</style>';
echo	'<div class=\'ads\'>';
#If you want to show image ads set $type = 0, if you want text ads set $type = 1, for both types set $type =  2
		$type	=	2;
#Put the number of random links you want here, maximum is 5 
		$num	=	5;
		$ads	=	rand(1,$num);
#Please change the urls to suit your needs
		$ad1	=	'<a href=\'http://libra.wen.ru\'>
				<img src=\'banner1.gif\' alt=\'libra\'/></a>';
		$ad2	=	'<a href=\'http://s3nzo.wen.ru\'>
				<img src=\'banner2.gif\' alt=\'s3nzo.wen.ru\'/></a>';
		$ad3	=	'<a href=\'http://m-phone.info/?id=konvictmobi\'>
				<img src=\'banner3.gif\' alt=\'m-phone\'/></a>';
		$ad4	=	'<a href=\'http://wap.konvict.mobi/?id=konvictmobi\'>
				<img src=\'banner4.gif\' alt=\'konvict.mobi\'/></a>';
		$ad5	=	'<a href=\'http://bluechild.co.cc\'>
				<img src=\'banner5.gif\' alt=\'BlueChild\'/></a>';
		$s3nzo	=	'<a href=\'http://konvict.mobi\'>KONVICT.mobi</a>';
		$ad	=	'Powered by';
		$txt	=	rand(1,$num);
		$txt1	=	'<a href=\'http://libra.wen.ru\'>LIBRA.wen.ru</a>';
		$txt2	=	'<a href=\'http://s3nzo.wen.ru\'>s3nzo.wen.ru</a>';
		$txt3	=	'<a href=\'http://m-phone.info/?id=konvictmobi\'>Free Hot Videos</a>';
		$txt4	=	'<a href=\'http://wap.konvict.mobi/?id=konvictmobi\'>Add Your site</a>';
		$txt5	=	'<a href=\'http://bluechild.co.cc\'>BlueChild</a>';
		$n	=	rand(1,10);
		$ads1	=	'<a href=\'http://libra.wen.ru\'>
				<img src=\'banner1.gif\' alt=\'libra\'/></a>';
		$ads2	=	'<a href=\'http://libra.wen.ru\'>LIBRA.wen.ru</a>';
		$ads3	=	'<a href=\'http://m-phone.info/?id=konvictmobi\'>
				<img src=\'banner3.gif\' alt=\'m-phone\'/></a>';
		$ads4	=	'<a href=\'http://s3nzo.wen.ru\'>s3nzo.wen.ru</a>';
		$ads5	=	'<a href=\'http://m-phone.info/?id=konvictmobi\'>
				<img src=\'banner3.gif\' alt=\'m-phone\'/></a>';
		$ads6	=	'<a href=\'http://m-phone.info/?id=konvictmobi\'>Free Hot Videos</a>';
		$ads7	=	'<a href=\'http://wap.konvict.mobi/?id=konvictmobi\'>
				<img src=\'banner4.gif\' alt=\'konvict.mobi\'/></a>';
		$ads8	=	'<a href=\'http://wap.konvict.mobi/?id=konvictmobi\'>Add Your site</a>';
		$ads9	=	'<a href=\'http://bluechild.co.cc\'>
				<img src=\'banner5.gif\' alt=\'BlueChild\'/></a>';
		$ads10	=	'<a href=\'http://bluechild.co.cc\'>BlueChild</a>';
if($type==0)
{
switch($ads)
	{
		case 1 : print $ad1.'<br>';
		break;
		case 2 : print $ad2.'<br>';
		break;
		case 3 : print $ad3.'<br>';
		break;
		case 4 : print $ad4.'<br>';
		break;
		case 5 : print $ad5.'<br>';
		break;
		default : print $s3nzo.'<br>';
	}

}
else if($type==1)
{
switch($txt)
	{
		case 1 : print $txt1.'<br>';
		break;
		case 2 : print $txt2.'<br>';
		break;
		case 3 : print $txt3.'<br>';
		break;
		case 4 : print $txt4.'<br>';
		break;
		case 5 : print $txt5.'<br>';
		break;
		default : print $s3nzo.'<br>';
	}

}
else
{
switch($n)
	{
		case 1 : print $ads1.'<br>';
		break;
		case 2 : print $ads2.'<br>';
		break;
		case 3 : print $ads3.'<br>';
		break;
		case 4 : print $ads4.'<br>';
		break;
		case 5 : print $ads5.'<br>';
		break;
		case 6 : print $ads6.'<br>';
		break;
		case 7 : print $ads7.'<br>';
		break;
		case 8 : print $ads8.'<br>';
		break;
		case 9 : print $ads9.'<br>';
		break;
		case 10 : print $ads10.'<br>';
		break;
		default : print $s3nzo.'<br>';
	}

}

echo $ad.' '.$s3nzo.'</div>';

?>
GumSlone Administrator Principal · 1,690 posts #3

its easier to use arrays like:

        $ad[]    =    '<a href=\'http://libra.wen.ru\'>
                <img src=\'banner1.gif\' alt=\'libra\'/></a>';
        $ad[]    =    '<a href=\'http://s3nzo.wen.ru\'>
                <img src=\'banner2.gif\' alt=\'s3nzo.wen.ru\'/></a>';
        $ad[]    =    '<a href=\'http://m-phone.info/?id=konvictmobi\'>
                <img src=\'banner3.gif\' alt=\'m-phone\'/></a>';
        $ad[]    =    '<a href=\'http://wap.konvict.mobi/?id=konvictmobi\'>
                <img src=\'banner4.gif\' alt=\'konvict.mobi\'/></a>';
        $ad[]    =    '<a href=\'http://bluechild.co.cc\'>
                <img src=\'banner5.gif\' alt=\'BlueChild\'/></a>';
       echo $ad[rand(0,count($ad)-1)].'<br/>';

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

s3nzo Developer · 156 posts #4

Thank you bro, i have learnt something new and useful today

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close