Jump to content

RANDOM INDEX PAGE


cosmickites

Recommended Posts

I have spent 3 months trying to get an answer to this.  We are looking to randominze either our index page or simply the body of the index page. I want the product review to be random when people come visit our page.

www.cosmickites.com

 

is this possible?  could anyone please please help?

 

Thank you

 

Michael

Link to comment
https://forums.phpfreaks.com/topic/93718-random-index-page/
Share on other sites

whoa, too many images and stuff for me to wait for it to load...

But here's a snippit of a 'rough' I did for someone a while back, it might be a little too much but it is fairly accurate:


session_start();


$l=array(0,1,2,3,4,5,0,1,2,3,0,1,0,1,0,1,0,1,0,0);
if(isset($_SESSION['redirector']))
{
$l = $_SESSION['redirector'];
}
if(count($l) == 0)
{
$l=array(0,1,2,3,4,5,0,1,2,3,0,1,0,1,0,1,0,1,0,0);
}

function get_redirect()
{
global $l;

$url[0] = "http://www.siteone.com";
$url[1] = "http://www.sitetwo.com";
$url[2] = "http://www.sitethree.com";
$url[3] = "http://www.sitefour.net";
$url[4] = "http://www.sitefive.com";
$url[5] = "http://www.sitesix.com";

srand ((double)microtime()*1000000);
$n = rand(0, count($l)-1);
$ll = array_keys($l);
$nn = $ll[$n];
$sret = $url[$l[$nn]];
unset($l[$nn]);
$_SESSION['redirector'] = $l;

return $sret;
}

print get_redirect();

Link to comment
https://forums.phpfreaks.com/topic/93718-random-index-page/#findComment-480215
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.