userdata["acclevel"] < 80) die ("Access denied!");
?>
title; ?>
\n";
$dbt = "Deleting all inactive Players";
echo "
$dbt ... ";
$minTimestamp = date("U")-(3600*24*30);
$SQL = "DELETE FROM hlstats_Players WHERE last_event<$minTimestamp;";
if ($db->query($SQL)) echo "OK\n"; else echo "ERROR\n";
$dbt = "Deleting Clans without Players";
echo "$dbt ... ";
$SQL = "DELETE FROM hlstats_Clans USING hlstats_Clans LEFT JOIN hlstats_Players ON (clan=clanId) WHERE isnull(clan);";
if ($db->query($SQL)) echo "OK\n"; else echo "ERROR\n";
$dbt = "Deleting Names from inactive Players";
echo "$dbt ... ";
$SQL = "DELETE FROM hlstats_PlayerNames USING hlstats_PlayerNames LEFT JOIN hlstats_Players ON (hlstats_PlayerNames.playerId=hlstats_Players.playerId) WHERE isnull(hlstats_Players.playerId);";
if ($db->query($SQL)) echo "OK\n"; else echo "ERROR\n";
$dbt = "Deleting SteamIDs from inactive Players";
echo "$dbt ... ";
$SQL = "DELETE FROM hlstats_PlayerUniqueIds USING hlstats_PlayerUniqueIds LEFT JOIN hlstats_Players ON (hlstats_PlayerUniqueIds.playerId=hlstats_Players.playerId) WHERE isnull(hlstats_Players.playerId);";
if ($db->query($SQL)) echo "OK\n"; else echo "ERROR\n";
$dbt = "Deleting Awards from inactive Players";
echo "$dbt ... ";
$SQL = "DELETE FROM hlstats_Players_Awards USING hlstats_Players_Awards LEFT JOIN hlstats_Players ON (hlstats_Players_Awards.playerId=hlstats_Players.playerId) WHERE isnull(hlstats_Players.playerId);";
if ($db->query($SQL)) echo "OK\n"; else echo "ERROR\n";
$dbt = "Deleting Ribbons from inactvie Players";
echo "$dbt ... ";
$SQL = "DELETE FROM hlstats_Players_Ribbons USING hlstats_Players_Ribbons LEFT JOIN hlstats_Players ON (hlstats_Players_Ribbons.playerId=hlstats_Players.playerId) WHERE isnull(hlstats_Players.playerId);";
if ($db->query($SQL)) echo "OK\n"; else echo "ERROR\n";
$dbt = "Deleting History from inactive Players";
echo "$dbt ... ";
$SQL = "DELETE FROM hlstats_Players_History USING hlstats_Players_History LEFT JOIN hlstats_Players ON (hlstats_Players_History.playerId=hlstats_Players.playerId) WHERE isnull(hlstats_Players.playerId);";
if ($db->query($SQL)) echo "OK\n"; else echo "ERROR\n";
// $dbt = "Resetting Players count for all servers";
// echo "$dbt ... ";
// $SQL = "UPDATE hlstats_Servers SET players=0;";
// if ($db->query($SQL)) echo "OK\n"; else echo "ERROR\n";
echo "\n";
echo "Done.";
}
else
{
?>