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


Random page generator





deluxetrade
Hi Guys,

On my site I want to have a script so that when you go to www.nameofmysite.com the script in that< head> loads in a random page.

ie, when I go to www.nameofmysite.com it could load:

either
www.nameofmysite.com/page1.html
or
www.nameofmysite.com/page2.html
or
www.nameofmysite.com/page3.html

Is there a script that does this. I know it can be done with one image using javascript, but I want it to call a random page, not just images?

Can anyone point me in the right direction or post a url to a script?

Thanks
WickedGravity
Correct me if I am wrong, but I believe that This Script here is what you are looking for and should fill your needs quite nicely.

There is also an easier way to do it via PHP, but you said script, so that is what I got for you.

Please let me know if I can be of any further assistance to you.
mathiaus
and heres the php alternative. Just stick this in index.php, nothing else needed.
if make a new page call page4.html etc and change the 3 in the code below to 4 etc.

Code:
<?php
$num = rand(0,3);
header("Location: http://www.nameofmysite.com/page" .$num. ".html");
?>
kv
I am just curious. Why somebody needs a random page on thier website?
EternalDragon
kv wrote:
I am just curious. Why somebody needs a random page on thier website?


Maybe just to get more people visiting...like to see what the other pages look like and maybe see how many other random pages there are.

Nice way to attract people Wink
Related topics
[c++]random number generator doesnt work
JAVA - random name generator
Random page or directory
Microsoft confirms that XP contains random number generator
Javascript random code generator script needed please
Python random password generator in one line
Pulling quotes from wikiquote
Visual Basic Tutorial - Random numbers
Problem connecting to MySQL database with PHP [RESOLVED]
One Click and boom! - Random Topic
Random Topic Generator
Is lottery totally random?
How did you come up with your username?
Personal WebPage building Tools..
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.