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


Random Image Display





NG
Step 1
Open your favourite text editor and copy the code and save that file as random.php:


Code:
<?php

$random = "random.txt";

$fp = file($random);
srand((double)microtime()*1000000);
$rl = $fp[array_rand($fp)];
echo $rl;
?>



Step 2
Next you will need to make a file called random.txt and it should include something like this:


Code:
<a href="banner.php?id=banner1"><img src="banner1.gif" border="0"></a>
<a href="banner.php?id=banner2"><img src="banner2.gif" border="0"></a>




Upload all files to your site (the ones you want in the random display)

Then include random.php in your page where you want them to show up, a simple php include can do this:
Related topics
Display random image on foreign site
random image code?
I want to output an img url from a random image script
IE8 not allowing new random image on each page (PHP and CSS)
Random Image
Random image for your gallery
question : how to display random image in main page?
Help with neat Image Display Code
Random Post on phpBB
A PHP Script Contest, winner get 100F$
Image Display Problem
Jamatus' Dynamic image store
PHP Image Questions
Layout gap problems with Javascript/PHP Combo
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.