View Single Post
Old 03-26-2002, 08:21 PM  
KC
Confirmed User
 
Industry Role:
Join Date: Jan 1995
Posts: 2,417
PHP Code:

<?
        $url1 = "http://www.myfirsturl.com/?mycode";
        $url2 = "http://www.mysecondurl.com/?myothercode";
        
        if (((date("s") + 1) % 2) == 0) {
                // even # of seconds
                $location = $url1;  
        } else {
                // odd # of seconds
                $location = $url2; 
        }
         
        header("Location: $location");
?>

Here's a quick and dirty UNTESTED! way to do it...

If you only want to redirect between 2 URLs and you want to keep them pretty even but not necessarily EXACTLY even, I would do something like that that didn't involve file I/O... any time you touch the disk it's going to get slow especially if you're going to throw a lot of traffic at it.

This just checks to see if the current second is even or odd and then forwards to either url1 or url2...

If you're only talking about 2 URLs and not needing to track any stats, I'd say something like this would work pretty damn well. \

So just copy that code into a php file, update the 2 urls and send traffic directly to the php page you create.

Good Luck!
-KC
__________________

Jupiter Hosting, Inc.
Vice President, Business Development
kc (AT) jupiterhosting.com
KC is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote