NamePros.Com (http://www.namepros.com/)
-   CODE (http://www.namepros.com/code/)
-   -   {Wanted} Random ad's script (http://www.namepros.com/code/154470-wanted-random-ads-script.html)

NetworkTown.Net 01-05-2006 12:00 PM

{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.

admans 01-05-2006 12:14 PM

Try this one...

i-fubar.com/rotation-ad-script.php

NetworkTown.Net 01-05-2006 12:55 PM

thanks but i cant do with tuts how to make it i would rater just download the script

Xyzer 04-05-2006 02:48 AM

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); ?>

weblord 04-05-2006 02:55 AM

try this:
http://phpadsnew.com/two/
you can just copy and paste any html code for the ad and it will rotate.

lilgee 04-05-2006 05:28 AM

Originally Posted by webmonkey
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); ?>




Nice job on it :) i like it, Simple script.

cvxdes 04-05-2006 06:47 PM

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:
<?
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];
?>

Borghunter 04-06-2006 04:27 PM

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.
In that text document include the following text.

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

snike 04-06-2006 04:41 PM

this is a very nice code. May I use it as well? i like the code above this post.

Borghunter 04-06-2006 06:09 PM

I don't really care who uses this code.
Can't find out anyways :) it's in PHP!


All times are GMT -7. The time now is 07:07 PM.
Site Sponsors
Advertise your business at NamePros

Powered by: vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0