userdata['acclevel'] < 80) { die ('Access denied!'); } ?>      title; ?>

\n"; $gamefilter = ''; if (isset($_POST['game']) && $_POST['game'] != '') { $gamefilter = " WHERE game='".$db->escape($_POST['game'])."'"; } $clearAll = isset($_POST['clear_all']); $clearAllDelete = isset($_POST['clear_all_delete']); $clearAllEvents = isset($_POST['clear_all_events']); if (isset($_POST['clear_awards']) || $clearAll || $clearAllDelete) { echo "
  • Clearing awards ... "; $db->query("UPDATE hlstats_Awards SET d_winner_id=NULL, d_winner_count=NULL, g_winner_id=NULL, g_winner_count=NULL $gamefilter"); if ($gamefilter == '') { $db->query("TRUNCATE TABLE `hlstats_Players_Awards`"); $db->query("TRUNCATE TABLE `hlstats_Players_Ribbons`"); } else { $db->query("DELETE FROM `hlstats_Players_Awards` $gamefilter"); $db->query("DELETE FROM `hlstats_Players_Ribbons` $gamefilter"); } echo "OK
  • \n"; } if (isset($_POST['clear_sessions']) || $clearAll || $clearAllDelete) { echo "
  • Removing players' session history ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Players_History`"; } else { $SQL = "DELETE FROM `hlstats_Players_History` $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_names']) || $clearAll || $clearAllDelete) { echo "
  • Removing players' names history ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_PlayerNames`"; } else { $SQL = "DELETE FROM `hlstats_PlayerNames` WHERE playerId IN (SELECT playerId FROM hlstats_Players $gamefilter)"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_names_counts']) || $clearAll || $clearAllDelete) { echo "
  • Resetting players' names' counts ... "; $SQL = "UPDATE `hlstats_PlayerNames` SET connection_time=0, numuses=0, kills=0, deaths=0, suicides=0, headshots=0, shots=0, hits=0 WHERE playerId IN (SELECT playerId FROM hlstats_Players $gamefilter)"; if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_skill']) || $clearAll || $clearAllDelete) { echo "
  • Resetting all Players' Skill ... "; $SQL = "UPDATE hlstats_Players SET skill=1000 $gamefilter"; if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_pcounts']) || $clearAll || $clearAllDelete) { echo "
  • Resetting all Players' Counts ... "; $SQL = "UPDATE hlstats_Players SET connection_time=0, kills=0, deaths=0, suicides=0, shots=0, hits=0, headshots=0, last_skill_change=0, kill_streak=0, death_streak=0 $gamefilter"; if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_scounts']) || $clearAll || $clearAllDelete) { echo "
  • Resetting Servers' Counts ... "; $db->query("UPDATE hlstats_Servers SET kills=0, players=0, rounds=0, suicides=0, ". "headshots=0, bombs_planted=0, bombs_defused=0, ct_wins=0, ts_wins=0, ". "ct_shots=0, ct_hits=0, ts_shots=0, ts_hits=0, ". "map_ct_shots=0, map_ct_hits=0, map_ts_shots=0, map_ts_hits=0, ". "map_rounds=0, map_ct_wins=0, map_ts_wins=0, map_started=0, map_changes=0, ". "act_map='', act_players=0 $gamefilter"); echo "OK
  • \n"; } if (isset($_POST['clear_wcounts']) || $clearAll || $clearAllDelete) { echo "
  • Resetting Weapons' Counts ... "; $SQL = "UPDATE hlstats_Weapons SET kills=0, headshots=0 $gamefilter"; if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_acounts']) || $clearAll || $clearAllDelete) { echo "
  • Resetting Actions' Counts ... "; $SQL = "UPDATE hlstats_Actions SET `count`=0 $gamefilter"; if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_mcounts']) || $clearAll || $clearAllDelete) { echo "
  • Resetting Maps' Counts ... "; $SQL = "UPDATE hlstats_Maps_Counts SET `kills`=0, `headshots`=0 $gamefilter"; if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_rcounts']) || $clearAll || $clearAllDelete) { echo "
  • Resetting Roles' Counts ... "; $SQL = "UPDATE hlstats_Roles SET picked=0, kills=0, deaths=0 $gamefilter"; if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_admin']) || $clearAll || $clearAllDelete) { echo "
  • Deleting Admin Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Admin`"; } else { $SQL = "DELETE FROM `hlstats_Events_Admin` USING `hlstats_Events_Admin` INNER JOIN hlstats_Servers ON (hlstats_Events_Admin.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_changename']) || $clearAll || $clearAllDelete) { echo "
  • Deleting Name Change Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_ChangeName`"; } else { $SQL = "DELETE FROM `hlstats_Events_ChangeName` USING `hlstats_Events_ChangeName` INNER JOIN hlstats_Servers ON (hlstats_Events_ChangeName.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_changerole']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Role Change Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_ChangeRole`"; } else { $SQL = "DELETE FROM `hlstats_Events_ChangeRole` USING `hlstats_Events_ChangeRole` INNER JOIN hlstats_Servers ON (hlstats_Events_ChangeRole.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_changeteam']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Team Change Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_ChangeTeam`"; } else { $SQL = "DELETE FROM `hlstats_Events_ChangeTeam` USING `hlstats_Events_ChangeTeam` INNER JOIN hlstats_Servers ON (hlstats_Events_ChangeTeam.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_chat']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Chat Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Chat`"; } else { $SQL = "DELETE FROM `hlstats_Events_Chat` USING `hlstats_Events_Chat` INNER JOIN hlstats_Servers ON (hlstats_Events_Chat.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_connects']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Connect Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Connects`"; } else { $SQL = "DELETE FROM `hlstats_Events_Connects` USING `hlstats_Events_Connects` INNER JOIN hlstats_Servers ON (hlstats_Events_Connects.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_disconnects']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Disconnect Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Disconnects`"; } else { $SQL = "DELETE FROM `hlstats_Events_Disconnects` USING `hlstats_Events_Disconnects` INNER JOIN hlstats_Servers ON (hlstats_Events_Disconnects.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_entries']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Entry Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Entries`"; } else { $SQL = "DELETE FROM `hlstats_Events_Entries` USING `hlstats_Events_Entries` INNER JOIN hlstats_Servers ON (hlstats_Events_Entries.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_frags']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Frag Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Frags`"; } else { $SQL = "DELETE FROM `hlstats_Events_Frags` USING `hlstats_Events_Frags` INNER JOIN hlstats_Servers ON (hlstats_Events_Frags.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_latency']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Latency Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Latency`"; $SQL2 = "TRUNCATE TABLE `hlstats_Events_StatsmeLatency`"; } else { $SQL = "DELETE FROM `hlstats_Events_Latency` USING `hlstats_Events_Latency` INNER JOIN hlstats_Servers ON (hlstats_Events_Latency.serverId=hlstats_Servers.serverId) $gamefilter"; $SQL2 = "DELETE FROM `hlstats_Events_StatsmeLatency` USING `hlstats_Events_StatsmeLatency` INNER JOIN hlstats_Servers ON (hlstats_Events_StatsmeLatency.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL) && $db->query($SQL2)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_actions']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Action Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_PlayerActions`"; $SQL2 = "TRUNCATE TABLE `hlstats_Events_PlayerPlayerActions`"; $SQL3 = "TRUNCATE TABLE `hlstats_Events_TeamBonuses`"; } else { $SQL = "DELETE FROM `hlstats_Events_PlayerActions` USING `hlstats_Events_PlayerActions` INNER JOIN hlstats_Servers ON (hlstats_Events_PlayerActions.serverId=hlstats_Servers.serverId) $gamefilter"; $SQL2 = "DELETE FROM `hlstats_Events_PlayerPlayerActions` USING `hlstats_Events_PlayerPlayerActions` INNER JOIN hlstats_Servers ON (hlstats_Events_PlayerPlayerActions.serverId=hlstats_Servers.serverId) $gamefilter"; $SQL3 = "DELETE FROM `hlstats_Events_TeamBonuses` USING `hlstats_Events_TeamBonuses` INNER JOIN hlstats_Servers ON (hlstats_Events_TeamBonuses.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL) && $db->query($SQL2) && $db->query($SQL3)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_rcon']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Rcon Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Rcon`"; } else { $SQL = "DELETE FROM `hlstats_Events_Rcon` USING `hlstats_Events_Rcon` INNER JOIN hlstats_Servers ON (hlstats_Events_Rcon.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_statsme']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Weapon Stats Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Statsme`"; $SQL2 = "TRUNCATE TABLE `hlstats_Events_Statsme2`"; } else { $SQL = "DELETE FROM `hlstats_Events_Statsme` USING `hlstats_Events_Statsme` INNER JOIN hlstats_Servers ON (hlstats_Events_Statsme.serverId=hlstats_Servers.serverId) $gamefilter"; $SQL2 = "DELETE FROM `hlstats_Events_Statsme2` USING `hlstats_Events_Statsme2` INNER JOIN hlstats_Servers ON (hlstats_Events_Statsme2.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL) && $db->query($SQL2)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_statsmetime']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Statsme Time Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_StatsmeTime`"; } else { $SQL = "DELETE FROM `hlstats_Events_StatsmeTime` USING `hlstats_Events_StatsmeTime` INNER JOIN hlstats_Servers ON (hlstats_Events_StatsmeTime.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_suicides']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Suicide Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Suicides`"; } else { $SQL = "DELETE FROM `hlstats_Events_Suicides` USING `hlstats_Events_Suicides` INNER JOIN hlstats_Servers ON (hlstats_Events_Suicides.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if (isset($_POST['clear_events_teamkills']) || $clearAll || $clearAllDelete || $clearAllEvents) { echo "
  • Deleting Teamkill Events ... "; if ($gamefilter == '') { $SQL = "TRUNCATE TABLE `hlstats_Events_Teamkills`"; } else { $SQL = "DELETE FROM `hlstats_Events_Teamkills` USING `hlstats_Events_Teamkills` INNER JOIN hlstats_Servers ON (hlstats_Events_Teamkills.serverId=hlstats_Servers.serverId) $gamefilter"; } if ($db->query($SQL)) { echo "OK
  • \n"; } else { echo "ERROR\n"; } } if ($clearAllDelete) { $dbtables = array( 'hlstats_Clans', 'hlstats_PlayerUniqueIds', 'hlstats_Players' ); foreach ($dbtables as $dbt) { echo "
  • Clearing $dbt ... "; if ($gamefilter == '') { $db->query("TRUNCATE TABLE $dbt"); } else { $db->query("DELETE FROM $dbt $gamefilter"); } echo "OK
  • \n"; } } echo "\n"; echo "Done.

    "; } else { $result = $db->query("SELECT code, name, hidden FROM `hlstats_Games` ORDER BY hidden, name, code;"); unset($games); $games[] = '