Mark Mulvey
05-24-2004, 04:20 PM
Does anybody know a simple code that i could place onmy index page and would randomly load a new page from a choice of five different ones?
Thanks in advance!
Thanks in advance!
|
Click to See Complete Forum and Search --> : randomly load new page? Mark Mulvey 05-24-2004, 04:20 PM Does anybody know a simple code that i could place onmy index page and would randomly load a new page from a choice of five different ones? Thanks in advance! MstrBob 05-24-2004, 05:34 PM Try something like this: <?PHP /* This array stores the five pages. */ $arr = array(0 => "page1.html", 5 => "page1.html", 1 => "page2.html", 6 => "page2.html", 2 => "page3.html", 7 => "page3.html", 3 => "page4.html", 8 => "page4.html", 4 => "page5.html", 9 => "page5.html", ); /* Gets last digit of time() */ $c_time=time(); $lstr=strlen($c_time); $lstr--; $c_chr=substr($c_time, $lstr, 1); /* Directs browser to corresponding page from the array. */ header("Location: " . $arr[$c_chr]); ?> webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |