Results 1 to 8 of 8
Hybrid View
-
03-03-2004, 06:53 PM #1Junior Guru Wannabe
- Join Date
- Aug 2003
- Posts
- 52
Randomly selecting different index page on each load?
I'm looking for the easiest and best way to have a different index.html file to load (randomly) each time someone visits my domain. I made 4 designs that I want to randomly load. I thought I could use the Cpanel random HTML feature in the scripts library, but I'm not entirely sure how that'd work. Any ideas on this?
I know of a way to do this in javascript, but is there any non-javascript way since some people disable javascript?
-
03-03-2004, 07:27 PM #2Web Hosting Master
- Join Date
- Jul 2002
- Location
- UK
- Posts
- 2,027
Use php to randomly select the page.
Although personally I would have one page with 4 selectable skins, instead of 4 seperate pages. Updating content will be a nightmare for you.Gone.
-
03-03-2004, 11:29 PM #3Web Hosting Master
- Join Date
- Jul 2003
- Posts
- 556
Yes, don't use JavaScript. You can do this serverside w/ ASP or PHP. You can write a small simple function that rotates your designs randomly.
The most comprehensive collection of QUALITY hand picked tutorial links on the internet.
http://www.tutorialmaniacs.com
-
03-04-2004, 06:27 AM #4Web Hosting Master
- Join Date
- Nov 2003
- Location
- Online
- Posts
- 1,217
use php to select ransomly designs or templates in inxed file.
-
03-05-2004, 08:55 PM #5Junior Guru Wannabe
- Join Date
- Aug 2003
- Posts
- 52
Thanks for the expert advice everyone. It sounds like I should use php. Can someone direct me to a relevant php script that would work in the manner described? I'll be doing a search on my own but I'd be greatful for some suggestions. Thanks.
-
03-05-2004, 09:24 PM #6Junior Guru Wannabe
- Join Date
- Aug 2003
- Posts
- 52
OK, I found this simple php code to do the trick:
<?php
srand((double)microtime()*1000000);
$thistimeindexfile = rand(1,4).".html";
include($thistimeindexfile);
?>
The problem is that I have this running on an addon domain on a linux cpanel server. When it forwards to one of the 4 html files, the URL then changes to:
myaddondomain.com.mymaindomain.com.
Obviously I don't want this (I don't want it to be obvious this is an addon domain, I want it to remain as thedomainthesepagesareon.com) if that makes any sense. Any ideas why this is occuring and how to prevent it?
-
03-06-2004, 12:15 AM #7Junior Guru Wannabe
- Join Date
- Aug 2003
- Posts
- 52
Anyone wanna take this on? There has to be a way so it shows the domain without showing it as just an addon domain .. daamn
so close..
-
03-06-2004, 07:37 AM #8Newbie
- Join Date
- Mar 2004
- Location
- Asia
- Posts
- 15
Patrick:
If it takes your to sub.domain.com then you might just have a extra "." in your code. Email me, I have working random code for you if yours doesn't work.