GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   php code for rotating index pages? (https://gfy.com/showthread.php?t=183362)

grannytgp 10-07-2003 07:38 AM

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.

VideoJ 10-07-2003 07:42 AM

PHP Code:

<?php
$page 
floormt_rand1,) );
include( 
"index$page.html" );
?>

Change the 3 to however many pages you want. Untested, but should work :)

Zorgman 10-07-2003 07:48 AM

PHP Code:

<?php
$rand 
rand(1,3);
include(
"index$rand.html");
?>


grannytgp 10-07-2003 09:43 AM

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?

mrthumbs 10-07-2003 10:17 AM

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..


All times are GMT -7. The time now is 12:41 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123