FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Ad Select Script





Firilacroco
I searched Google but I didn't find what I want.

I want a script which selects a random ads and shows it.


For example: I have 4 different ads. The script shows the script number 2, next time when you refresh the page, it shows no 4, etc.


Can somebody help me? Rolling Eyes Please Very Happy
sonam
Go on my site Phoenix (in sig) and dowload a Hercules image/banner rotator. If you need any help post here.

Sonam
Firilacroco
Hmmm... and if I have a swf? Shocked
sonam
No, this is only for jpg, gif and png. Did you have four swf?

Sonam
Firilacroco
Just one Sad Anyway thanks for script! I'll make a gif from that swf.
rvec
it's not really hard to make a small script to do that. If you could post the html code you want I could easily make something in 10 min that will display one randomly whenever you call the function.
DjMilez
I think I know what you want... methinks.... anyway, I found this:

Quote:
Code:
<?
//Create an array so we can sort the banners out in order of 1, 2 and 3
$banners = array("banner1.gif", "banner2.gif", "banner3.gif");
$links = array("link 1", "link 2", "link 3");

//Create a random number to use later on (must be from 0 to 2 if ur using 3 banners
$randomnumber = rand(0, 2);

//Now time to make the random image
echo "<a href='" . $links[$randomnumber] . "'><img src='" . $banners[$randomnumber] . "'></a>";
?>


http://rmb-scripting.com/tutorials.php?tutorial&tid=235
rvec
You could also do it like this:
Code:
$input = array('<a href=""><img src=""></a>', '<a href=""></a>', '<a href=""></a>', '<a href=""></a>', '<a href=""></a>');
$rand_add= array_rand($input);
echo $input[$rand_add];
sonam
Or you can do it on this way:
Code:
$array= array('<a href=""><img src=""></a>', '<a href=""></a>', '<a href=""></a>', '<a href=""></a>', '<a href=""></a>');
shuffle($array);
echo $array[0];


It is nice how many possibilites are in the PHP. Very Happy

Sonam
Related topics
How did you hear about FRIHost ?
All google ads to Images
Need help placing ads
the best way to add a search function is?
Javascript disables Scroll in webpage..!!
Select and click
script backup database
Java script
Suggest a Free or Trial classifieds script
MySQL DB Backup script - minor problem
Inserting data to MYSQL with a PHP script
Aligning text with an image or text ad
$_Post Variable for Options from Select Types?
looking for password gate script
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.