255)) $comment = substr($comment,0,255);
if (!empty($comment)) {
$query = "INSERT INTO $shouttable (username,shouttext,shoutdate) VALUES ('".$_SESSION['s_username']."','$comment',NOW())";
$res = mysql_query($query) or die(mysql_error());
$query = "SELECT id FROM $shouttable ORDER BY shoutdate ASC";
$res = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($res) > $maxshouts) {
$number = mysql_num_rows($res);
$where = " id IN (";
$i = 0;
while ($line = mysql_fetch_object($res)) {
if ($i < ($number-$maxshouts)) $where .= $line->id.",";
else break;
$i++;
}
$where = substr($where,0,strlen($where)-1).")";
$query = "DELETE FROM $shouttable WHERE ".$where;
$res = mysql_query($query) or die(mysql_error());
}
}
}
$query = "SELECT count(*) as anzahl FROM $dbtablename WHERE planet=1";
$res = mysql_query($query);
if (!$res) $_SESSION['s_systems'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_systems'] = number_format($line->anzahl,0,",",".");
}
if (!isset($_SESSION['s_lastweek']) && strpos($_SERVER['SERVER_ADDR'],"192.168.2.2.galaxytool-hosting.eu") === false) {
$query = "SELECT count(*) as anzahl FROM $dbtablename WHERE planet=1 AND DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= last_update";
$res = mysql_query($query) or die(mysql_error());
if (!$res) $_SESSION['s_lastweek'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_lastweek'] = number_format($line->anzahl,0,",",".");
}
}
if (!isset($_SESSION['s_too_old']) && strpos($_SERVER['SERVER_ADDR'],"192.168.2.2.galaxytool-hosting.eu") === false) {
$query = "SELECT count(*) as anzahl FROM $dbtablename WHERE planet=1 AND DATE_SUB(CURDATE(),INTERVAL 30 DAY) > last_update";
$res = mysql_query($query);
if (!$res) $$_SESSION['s_too_old'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_too_old'] = number_format($line->anzahl,0,",",".");
}
}
$query = "SELECT count(*) as anzahl FROM $utablename";
$res = mysql_query($query);
if (!$res) $_SESSION['s_req_user'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_req_user'] = number_format($line->anzahl,0,",",".");
}
$query = "SELECT count(*) as anzahl FROM $noticetable";
$res = mysql_query($query);
if (!$res) $_SESSION['s_notices'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_notices'] = number_format($line->anzahl,0,",",".");
}
$query = "SELECT count(*) as anzahl FROM $playertable";
$res = mysql_query($query);
if (!$res) $_SESSION['s_players'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_players'] = number_format($line->anzahl,0,",",".");
}
$query = "SELECT count(*) as anzahl FROM $allytable";
$res = mysql_query($query);
if (!$res) $_SESSION['s_allies'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_allies'] = number_format($line->anzahl,0,",",".");
}
$query = "SELECT count(*) as anzahl FROM $reporttable";
$res = mysql_query($query);
if (!$res) $_SESSION['s_reports'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_reports'] = number_format($line->anzahl,0,",",".");
}
if (!isset($_SESSION['s_umods'])) {
$query = "SELECT count(*) as anzahl FROM $playertable WHERE vacation='true'";
$res = mysql_query($query);
if (!$res) $_SESSION['s_umods'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_umods'] = number_format($line->anzahl,0,",",".");
}
}
if (!isset($_SESSION['s_moons'])) {
$query = "SELECT count(*) as anzahl FROM $dbtablename WHERE moon='true'";
$res = mysql_query($query);
if (!$res) $_SESSION['s_moons'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_moons'] = number_format($line->anzahl,0,",",".");
}
}
if (!isset($_SESSION['s_raidable'])) {
$query = "SELECT count(*) as anzahl FROM $dbtablename g, $playertable p WHERE g.player_id = p.id AND banned='false' AND vacation='false' AND noob='false'";
$res = mysql_query($query);
if (!$res) $_SESSION['s_raidable'] = 0;
else {
$line = mysql_fetch_object($res);
$_SESSION['s_raidable'] = number_format($line->anzahl,0,",",".");
}
}
// these queries are much to slow for mysql as they cause filesort + temp_tables
//if (!isset($_SESSION['s_empty_systems']) && strpos($_SERVER['SERVER_ADDR'],"192.168.2.2.galaxytool-hosting.eu") === false) {
// $query = "SELECT concat(galaxy,':',system) as systems FROM $dbtablename WHERE player_id = '0' GROUP BY systems HAVING count(*) = 15";
// $res = mysql_query($query) or die(mysql_error());
// if (!$res) $_SESSION['s_empty_systems'] = 0;
// else {
// $_SESSION['s_empty_systems'] = number_format(mysql_num_rows($res),0,",",".");
// }
//}
//if (!isset($_SESSION['s_full_systems']) && strpos($_SERVER['SERVER_ADDR'],"192.168.2.2.galaxytool-hosting.eu") === false) {
// $query = "SELECT concat(galaxy,':',system) as systems FROM $dbtablename WHERE player_id != 0 GROUP BY systems HAVING count(*) = 15";
// $res = mysql_query($query);
// if (!$res) $_SESSION['s_full_systems'] = 0;
// else {
// $_SESSION['s_full_systems'] = number_format(mysql_num_rows($res),0,",",".");
// }
//}
$query = "SELECT u.username,p.id FROM $utablename u LEFT JOIN $playertable p ON (u.ingame=p.playername AND u.ingame!='') WHERE last_action > (NOW() - 300)";
$res = mysql_query($query) or die(mysql_error());
$online = array();
while ($line = mysql_fetch_object($res)) {
if (trim($line->id) != "") {
array_push($online,"id."\">".$line->username."");
} else {
array_push($online,$line->username);
}
}
$query = "SELECT u.username,p.id FROM $utablename u LEFT JOIN $playertable p ON (u.ingame=p.playername AND u.ingame!='') WHERE last_action > '".date("Y-m-d")." 00:00:00'";
$res = mysql_query($query) or die(mysql_error());
$today = array();
while ($line = mysql_fetch_object($res)) {
if (trim($line->id) != "") {
array_push($today,"id."\">".$line->username."");
} else {
array_push($today,$line->username);
}
}
$query = "SELECT sum(logins) as overall FROM $utablename";
$res = mysql_query($query) or die(mysql_error());
$line = mysql_fetch_object($res);
$overall = $line->overall;
makeheader(INDEX_TITLE);
if (isset($_GET['versionscheck'])) {
$version = VERSION;
$latest_version = @file_get_contents("http://www.galaxietool.de/version.txt");
}
?>
|
'.INDEX_VERSION.' | '.$latest_version." | \n";
} elseif (isset($latest_version)) {
echo ''.INDEX_LATEST_VERSION." | \n";
}
if (isset($_SESSION['s_systems'])) echo ''.INDEX_ENTRIES.' | '.$_SESSION['s_systems'].' | ';
if (isset($_SESSION['s_lastweek'])) echo ' '.INDEX_ENTRIES_LASTWEEK.' | '.$_SESSION['s_lastweek'].' | ';
if (isset($_SESSION['s_too_old'])) echo ' '.INDEX_ENTRIES_TO_OLD.' | '.$_SESSION['s_too_old'].' | ';
if (isset($_SESSION['s_req_user'])) echo ' '.INDEX_REGISTERED_USERS.' | '.$_SESSION['s_req_user'].' | ';
if (isset($_SESSION['s_notices'])) echo ' '.INDEX_NOTICES.' | '.$_SESSION['s_notices'].' | ';
if (isset($_SESSION['s_players'])) echo ' '.INDEX_PLAYERS.' | '.$_SESSION['s_players'].' | ';
if (isset($_SESSION['s_allies'])) echo ' '.INDEX_ALLIES.' | '.$_SESSION['s_allies'].' | ';
if (isset($_SESSION['s_reports'])) echo ' '.INDEX_REPORTS.' | '.$_SESSION['s_reports'].' | ';
if (isset($_SESSION['s_umods'])) echo ' '.INDEX_UMOD.' | '.$_SESSION['s_umods'].' | ';
if (isset($_SESSION['s_moons'])) echo ' '.INDEX_NO_MOONS.' | '.$_SESSION['s_moons'].' | ';
if (isset($_SESSION['s_raidable'])) echo ' '.INDEX_NO_TARGETS.' | '.$_SESSION['s_raidable'].' | ';
if (isset($_SESSION['s_empty_systems'])) echo ' '.INDEX_NO_EMPTY_SYSTEMS.' | '.$_SESSION['s_empty_systems'].' | ';
if (isset($_SESSION['s_full_systems'])) echo ' '.INDEX_NO_FULL_SYSTEMS.' | '.$_SESSION['s_full_systems'].' | ';
?>
|
"; echo count($online); ?> | |
"; echo count($today); ?> | |
"; echo $overall; ?> |
|