Created
May 20, 2014 12:53
-
-
Save localhots/49c4734e0b80935ae179 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$config_file = "default.json"; | |
$config = json_decode(file_get_contents($config_file)); | |
$host = $config["default_host"]; | |
$uri = $_SERVER["QUERY_STRING"]; | |
if ($config["ab_enabled"]) { | |
if (in_array($_COOKIE["ab"], $config["ab_hosts"])) { | |
$host = $_COOKIE["ab"]; | |
} else { | |
$host = array_rand($config["ab_hosts"]); | |
setcookie("ab", $host, 86400); | |
} | |
} | |
header("Location: http://$host$uri"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment