function Status_Antrix($aServer) { $sUptime = "N/A"; if (is_array($aServer)) { $rMySql = mysql_connect($aServer['db_host'], $aServer['db_user'], $aServer['db_pass']); if ($rMySql) { if (mysql_select_db($aServer['db_server'], $rMySql)) { $rQuery = mysql_query("SELECT `online`, UNIX_TIMESTAMP(`timestamp`) AS `timestamp` FROM `server` LIMIT 1", $rMySql); if ($rQuery && mysql_num_rows($rQuery) == 1) { $aRow = mysql_fetch_assoc($rQuery); if ($aRow['online'] == 0) return FALSE; if ($aRow['timestamp'] > 0) { $iUptime = time() - $aRow['timestamp']; // Calculate the Uptime $iWeeks = floor($iUptime / (60 * 60 * 24 * 7)); $iUptime -= $iWeeks * 60 * 60 * 24 * 7; $iDays = floor($iUptime / (60 * 60 * 24)); $iUptime -= $iDays * 60 * 60 * 24; $iHours = floor($iUptime / (60 * 60)); $iUptime -= $iHours * 60 * 60; $iMinutes = floor($iUptime / 60); $sUptime = trim(str_replace(array("%w", "%d", "%h", "%m"), array($iWeeks ? $iWeeks ."w" : "", $iDays ? $iDays ."d" : "", $iHours ? $iHours ."h" : "", $iMinutes ? $iMinutes ."m" : ""), UPTIME)); } mysql_free_result($rQuery); } $rQuery = mysql_query("SELECT c.acct, c.name, c.level, c.class, c.race, c.mapId, c.zoneId, a.gm, a.lastip FROM `characters` AS c, `accounts` AS a WHERE `online` = 1 AND c.acct = a.acct", $rMySql); if ($rQuery && mysql_num_rows($rQuery) > 0) { $aOutput[] = ''; $aOutput[] = ""; $aOutput[] = "\t"; $aOutput[] = "\t\t0.6"; $aOutput[] = "\t\t0"; $aOutput[] = "\t\t0"; $aOutput[] = "\t\t". $sUptime .""; $aOutput[] = "\t"; $aOutput[] = "\t"; $aOutput[] = "\t"; $aOutput[] = "\t"; // 0 = account // 1 = name // 2 = level // 3 = class // 4 = race // 5 = mapId // 6 = zoneId // 7 = gm // 8 = lastip while ($aRow = mysql_fetch_row($rQuery)) { $aOutput[] = "\t\t"; $aOutput[] = "\t\t\t". $aRow[1] .""; $aOutput[] = "\t\t\t". $aRow[4] .""; $aOutput[] = "\t\t\t". $aRow[3] .""; $aOutput[] = "\t\t\t". $aRow[2] .""; $aOutput[] = "\t\t\t". $aRow[5] .""; $aOutput[] = "\t\t\t". $aRow[6] .""; $aOutput[] = "\t\t\t0"; $aOutput[] = "\t\t\t". $aRow[7] .""; $aOutput[] = "\t\t\t". $aRow[8] .""; $aOutput[] = "\t\t"; } mysql_free_result($rQuery); mysql_close($rMySql); $aOutput[] = "\t"; $aOutput[] = ""; return utf8_encode(implode("\n", $aOutput)); } mysql_close($rMySql); exit(DEBUG ? "DEBUG: Unable to get list of players." : 0); } mysql_close($rMySql); exit(DEBUG ? "DEBUG: Unable to select server database." : 0); } exit(DEBUG ? "DEBUG: Unable to connect to MySQL." : 0); } }