I wrote this script a few days ago, there seems to be a problem though. I also have a question: can you make a variable equal another variable like $foo = $foo_foo. Basically what it is doing is
Check if the backup server (sf.net one) is down if it is echo a second backup, generate a variable
Check if the cache1 (US) server is down if it is echo the backup one
Check if the cache2 (ASIA) server is down if it is echo the backup one
Check if the cache3 (EUROPE) server is down if it is down echo the backup one
Now the switch: That reads a premade cookie to determine your continent and echos your correct server.
<?php
#################
# SERVER CHOOSE #
#################
$cache1 = "http://cache1.infinity-media.co.cc/";
$cache2 = "http://cache2.infinity-media.co.cc/";
$cache3 = "http://cache3.infinity-media.co.cc/";
$cache = "http://theopencache.sf.net";
$cookie = $_COOKIE['cache-location'];
//OpenCache Failsafe
if(file_get_contents($cache) == "" && is_null($cache)) {$sf = "http://aerocrash.co.cc/cache/";}
else {$sf = "http://theopencache.sf.net/";}
//Cache1 Failsafe
if(file_get_contents($cache1) == "" && is_null($cache1)) {$host = $sf;}
else {$cc1 = "http://cache1.infinity-media.co.cc/";}
//Cache2 Failsafe
if(file_get_contents($cache2) == "" && is_null($cache2)) {$host = $sf;}
else {$cc2 = "http://cache2.infinity-media.co.cc";}
//Cache3 Failsafe
if(file_get_contents($cache3) == "" && is_null($cache3)) {$host = $sf;}
else {$cc3 = "http://cache3.infinity-media.co.cc";}
switch ($cookie) {
case "EU":
$host = $cc3;
break;
case "NA":
$host = $cc1;
break;
case "SA":
$host = $cc1;
break;
case "AS":
$host = $cc2;
break;
case "AF":
$host = $cc3;
break;
case "OC":
$host = $cc1;
break;
case "AN":
$host = $cc1;
break;
}
echo $host;
echo $cc1.$ccs.$cc3;
echo "Hello ^";
?>
Thanks in Advance