NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page {Wanted} Random ad's script

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 01-05-2006, 12:00 PM THREAD STARTER               #1 (permalink)
Account Closed
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice
 



{Wanted} Random ad's script


I need a random ads script i dont want the script like i have to upload and banner and stuff i want it so i just put in the html (like google codes and clicksor codes ect) and it will show it on my homepage ect.
NetworkTown.Net is offline  
Old 01-05-2006, 12:14 PM   #2 (permalink)
NamePros Regular
Join Date: Jul 2005
Posts: 912
admans is just really niceadmans is just really niceadmans is just really niceadmans is just really niceadmans is just really nice
 



Try this one...

i-fubar.com/rotation-ad-script.php
admans is offline  
Old 01-05-2006, 12:55 PM THREAD STARTER               #3 (permalink)
Account Closed
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice
 



thanks but i cant do with tuts how to make it i would rater just download the script
NetworkTown.Net is offline  
Old 04-05-2006, 02:48 AM   #4 (permalink)
Senior Member
 
Xyzer's Avatar
Join Date: Aug 2005
Location: United Kindom
Posts: 1,502
Xyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to allXyzer is a name known to all
 


Tsunami Relief AIDS/HIV
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); 
?>
Xyzer is offline  
Old 04-05-2006, 02:55 AM   #5 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness
 


Autism Protect Our Planet
try this:
http://phpadsnew.com/two/
you can just copy and paste any html code for the ad and it will rotate.
__________________
Nabaza.com - Amaia
weblord is offline  
Old 04-05-2006, 05:28 AM   #6 (permalink)
Senior Member
Join Date: Sep 2005
Location: NC
Posts: 2,323
lilgee is a name known to alllilgee is a name known to alllilgee is a name known to alllilgee is a name known to alllilgee is a name known to alllilgee is a name known to alllilgee is a name known to alllilgee is a name known to all
 



Originally Posted by webmonkey
I have made you one:
????: NamePros.com http://www.namepros.com/code/154470-wanted-random-ads-script.html
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); 
?>
Nice job on it i like it, Simple script.
__________________
Sharing 50% profit for helping to sell on ebay. PM me for more info.
lilgee is offline  
Old 04-05-2006, 06:47 PM   #7 (permalink)
NamePros Regular
 
cvxdes's Avatar
Join Date: Oct 2005
Location: Milford MA
Posts: 692
cvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud of
 



I prefer flatDB for 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 Code:
<?
????: NamePros.com http://www.namepros.com/showthread.php?t=154470
funtion ad_template
($url$img){
    
$ad "<a href='".$url."'><img src='".$img."' alt=''/>";
    return 
$ad;
}
$i 0;
????: NamePros.com http://www.namepros.com/showthread.php?t=154470
$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];
?>
cvxdes is offline  
Old 04-06-2006, 04:27 PM   #8 (permalink)
Resistance is Futile
 
Kadenz's Avatar
Join Date: Apr 2006
Location: Montreal, Canada
Posts: 1,094
Kadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to all
 



Wildlife Lou Gehrig's Disease (ALS)
You can use this code in the area you want the ad:
PHP Code:
<?php
$fcontents 
join (""file ("banner_ads.txt"));
$s_con split("~",$fcontents);
$banner_no rand(0,(count($s_con)-1));
echo 
$s_con[$banner_no];
?>
and create a text document named "banner_ads.txt" in the same directory.
????: NamePros.com http://www.namepros.com/showthread.php?t=154470
In that text document include the following text.

Code:
YOUR FIRST AD CODE
~
YOUR SECOND AD CODE
~
YOUR THIRD AD CODE
~

etc.....
__________________
Freelance Web Developer
PHP, MySQL, XHTML, CSS, Javascript, jQuery, Wordpress
Portfolio: www.bundy.ca
Last edited by Kadenz; 04-06-2006 at 04:30 PM.
Kadenz is offline  
Old 04-06-2006, 04:41 PM   #9 (permalink)
NamePros Regular
 
snike's Avatar
Join Date: Mar 2006
Location: USA
Posts: 497
snike has a spectacular aura aboutsnike has a spectacular aura about
 


Save a Life
this is a very nice code. May I use it as well? i like the code above this post.
snike is offline  
Old 04-06-2006, 06:09 PM   #10 (permalink)
Resistance is Futile
 
Kadenz's Avatar
Join Date: Apr 2006
Location: Montreal, Canada
Posts: 1,094
Kadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to allKadenz is a name known to all
 



Wildlife Lou Gehrig's Disease (ALS)
I don't really care who uses this code.
Can't find out anyways it's in PHP!
__________________
Freelance Web Developer
PHP, MySQL, XHTML, CSS, Javascript, jQuery, Wordpress
Portfolio: www.bundy.ca
Kadenz is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wanted - Web Hosting Directory Script. senaia Website Development 3 12-03-2005 07:27 AM
Part time PHP script installer and customer service rep wanted (offer closed) RJ Scripts For Sale 2 05-07-2005 01:33 AM
coder wanted for name script ypn Website Development 2 10-09-2003 03:04 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 01:04 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger