Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-07-2003, 07:38 AM   #1
grannytgp
Confirmed User
 
Join Date: Aug 2002
Posts: 269
php code for rotating index pages?

Can anybody help out with some simple PHP code to rotate three or more different index pages?

Basically, what I'm looking to do is test out some new page designs on a site. Right now I have the following code working just fine for two pages:

PHP Code:
<?php
if (mt_rand(1,2hahahaha 1) { include("index1.html"); }
else { include(
"index2.html"); }
?>
Simple enough... it rotates between the index1.html and index2.html pages in the same directory. But I'm looking to test at least 3 pages now, and was thinking it would be nice to possibly be able to set a weighted percentage on any of these pages.
grannytgp is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-07-2003, 07:42 AM   #2
VideoJ
Confirmed User
 
Join Date: Aug 2002
Location: S. Florida
Posts: 750
PHP Code:
<?php
$page 
floormt_rand1,) );
include( 
"index$page.html" );
?>
Change the 3 to however many pages you want. Untested, but should work
__________________
Somebody stole my damn signture...
VideoJ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-07-2003, 07:48 AM   #3
Zorgman
Confirmed User
 
Zorgman's Avatar
 
Join Date: Aug 2002
Location: Sydney, Australia
Posts: 6,103
PHP Code:
<?php
$rand 
rand(1,3);
include(
"index$rand.html");
?>
__________________
---
Zorgman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-07-2003, 09:43 AM   #4
grannytgp
Confirmed User
 
Join Date: Aug 2002
Posts: 269
These both work just fine.. although the second one with the $rand does seem to return more steady distribution of the pages -- although this was only in a very limited test refreshing the page about 20 times.

Which method would be suggested for the most equal distribution?
grannytgp is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-07-2003, 10:17 AM   #5
mrthumbs
salad tossing sig guy
 
mrthumbs's Avatar
 
Join Date: Apr 2002
Location: mrthumbs*gmail.com
Posts: 11,702
Quote:
Originally posted by grannytgp
These both work just fine.. although the second one with the $rand does seem to return more steady distribution of the pages -- although this was only in a very limited test refreshing the page about 20 times.

Which method would be suggested for the most equal distribution?
rand is as steady as nature gets..
mrthumbs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.