userdata["acclevel"] < 80) die ("Access denied!"); function delete_game($game) { global $db; $srvtables = array( "hlstats_Events_Admin", "hlstats_Events_ChangeName", "hlstats_Events_ChangeRole", "hlstats_Events_ChangeTeam", "hlstats_Events_Chat", "hlstats_Events_Connects", "hlstats_Events_Disconnects", "hlstats_Events_Entries", "hlstats_Events_Frags", "hlstats_Events_Latency", "hlstats_Events_PlayerActions", "hlstats_Events_PlayerPlayerActions", "hlstats_Events_Rcon", "hlstats_Events_Statsme", "hlstats_Events_Statsme2", "hlstats_Events_StatsmeLatency", "hlstats_Events_StatsmeTime", "hlstats_Events_Suicides", "hlstats_Events_TeamBonuses", "hlstats_Events_Teamkills", "hlstats_Servers_Config" ); $pltables = array( "hlstats_PlayerNames" ); $dbtables = array( "hlstats_Actions", "hlstats_Awards", "hlstats_Ribbons", "hlstats_Roles", "hlstats_Teams", "hlstats_Weapons", "hlstats_Ranks", "hlstats_Maps_Counts", "hlstats_Servers", "hlstats_Players_History", "hlstats_Players_Awards", "hlstats_Players_Ribbons", "hlstats_PlayerUniqueIds", "hlstats_Players", "hlstats_Clans", "hlstats_Trend" ); $resultServers = $db->query("SELECT serverId FROM hlstats_Servers WHERE game = '$game'"); if ($db->num_rows($resultServers) > 0) { $serverlist = "("; while ($server = $db->fetch_row($resultServers)) { $serverlist .= $server[0].','; } $serverlist = preg_replace('/,$/', ')',$serverlist); foreach ($srvtables as $srvt) { echo "
  • $srvt ... "; $db->query("DELETE FROM $srvt WHERE serverId IN $serverlist"); echo "OK
  • \n"; } echo "
  • hlstats_server_load ... "; $db->query("DELETE FROM hlstats_server_load WHERE server_id IN $serverlist"); echo "OK
  • \n"; } $resultPlayers = $db->query("SELECT playerId FROM hlstats_Players WHERE game = '$game'"); if ($db->num_rows($resultPlayers) > 0) { $playerlist = "("; while ($player = $db->fetch_row($resultPlayers)) { $playerlist .= $player[0].','; } $playerlist = preg_replace('/,$/', ')',$playerlist); foreach ($pltables as $plt) { echo "
  • $plt ... "; $db->query("DELETE FROM $plt WHERE playerId IN $playerlist"); echo "OK
  • \n"; } } foreach ($dbtables as $dbt) { echo "
  • $dbt ... "; echo removeGameSettings($dbt, $game); } echo "
  • hlstats_Games ..."; $db->query("DELETE FROM hlstats_Games WHERE code='$game'"); echo "OK\n"; echo "

    \n"; echo "Done.

    "; } function removeGameSettings($table, $game) { global $db; $db->query("SELECT COUNT(game) AS cnt FROM $table WHERE game='$game';"); $r = $db->fetch_array(); if ($r['cnt'] == 0) { $ret = "No data existent for selected gametype."; } else { $ret = $r['cnt']." entries deleted!"; $SQL = "DELETE FROM $table WHERE game='$game';"; $db->query($SQL); } return $ret."\n"; } $edlist = new EditList("code", "hlstats_Games", "game", false, false, "", 'delete_game'); $edlist->columns[] = new EditListColumn("code", "Game Code", 10, true, "readonly", "", 16); $edlist->columns[] = new EditListColumn("name", "Display Name", 30, true, "text", "", 128); $edlist->columns[] = new EditListColumn("realgame", "Game", 50, true, "select", "hlstats_Games_Supported.name/code/", 128); $edlist->columns[] = new EditListColumn("hidden", "

    Hide Game
    ", 0, false, "checkbox"); if ($_POST) { if ($edlist->update()) message("success", "Operation successful."); else message("warning", $edlist->error()); } ?> Enter the codes and full names for all the games you want to collect statistics for. (Game codes should be the same as the mod folder name, e.g. "valve".)

    After creating a game, you will be able to configure servers, awards, etc. for that game under Game Settings.

    NOTE: Be cautious of deleting a game. Deleting a game will remove all related settings, including servers, players, and events for that game (and may take a while). You will have to manually remove any images yourself. IF YOU DELETE THE LAST GAME OF A TYPE, THERE IS NO EASY WAY TO MAKE A NEW GAME OF THAT TYPE. If you want to delete and that is the case, you are probably better off deleting all servers for that game and then just hiding the game.

    query(" SELECT code, name, realgame, hidden FROM hlstats_Games ORDER BY code ASC "); $edlist->draw($result, false); ?>