Web Hosting Talk







View Full Version : Script for random page? Plz help!


Mooncow
08-18-2003, 07:05 AM
Well - you see, i want my frame called "logo" to display a random page between logo1.html, logo2.html, logo3.html, etc. when the page is loaded.

How do i do this? Can anyone help me and give me a script to do this?

:confused:

neOnbubble
08-18-2003, 07:51 AM
Assumes you can use PHP scripting ...

Change your frame source. From:


src = "logo.html"


To:


src = "logo.php"


Then add a page called logo.php with the following code:


<?
srand((double)microtime()*1000000);
$newpage = "http://yourdomain.com/logo".rand(1,5).".html";
header("Location: $newpage");
?>


Which will then select a page from logo1.html to logo5.html at random assuming you had 5. If not then change the middle line of code accordingly.

Mooncow
08-18-2003, 07:57 AM
ok thanks! But i also have an image - where should that go?

ok 1 sec

Mooncow
08-18-2003, 08:07 AM
it works great thanks!!!!!