コード例 #1
0
 public static function GetAllRealms()
 {
     $Statement = Realms::$AConnection->prepare('SELECT id, name, address, port, icon, flag, timezone, population, gamebuild FROM realmlist');
     $Statement->execute();
     $Result = $Statement->fetchAll(PDO::FETCH_ASSOC);
     $Index = 0;
     foreach ($Result as $Server) {
         $CheckConnection = @fsockopen($Server['address'], $Server['port'], $errno, $errstr, 0.5);
         if ($CheckConnection) {
             $Result[$Index]['status'] = "up";
         } else {
             $Result[$Index]['status'] = "down";
         }
         $Result[$Index]['type'] = Realms::RealmTypeByID($Server['icon']);
         $Result[$Index]['language'] = Realms::LanguageByID($Server['timezone']);
         $Result[$Index]['uptime'] = Realms::GetUptimeForRealm($Server['id']);
         $Result[$Index]['online'] = Realms::GetOnlineForRealm($Server['id']);
         $Index++;
     }
     return $Result;
 }