From 40dfa7d5c0dc8e4cb2c95e403b6b4b2c4bf70644 Mon Sep 17 00:00:00 2001 From: Matthijs Kuiper Date: Sat, 4 Feb 2017 16:05:45 +0100 Subject: Original UTStats beta 4.2.8 --- html/pages/admin/dpmatch.php | 106 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100755 html/pages/admin/dpmatch.php (limited to 'html/pages/admin/dpmatch.php') diff --git a/html/pages/admin/dpmatch.php b/html/pages/admin/dpmatch.php new file mode 100755 index 0000000..b021054 --- /dev/null +++ b/html/pages/admin/dpmatch.php @@ -0,0 +1,106 @@ + + + +'; + +echo' + '; + +$q_radjust = small_query("SELECT pid, gid, rank FROM uts_player WHERE id = $pid"); +if (!$q_radjust) { + $sql_crank = false; +} else { + $rank_pid = $q_radjust[pid]; + $rank_gid = $q_radjust[gid]; + $rank = $q_radjust[rank]; + + $sql_crank = small_query("SELECT id, rank, matches FROM uts_rank WHERE pid = $rank_pid AND gid = '$rank_gid'"); +} +if (!$sql_crank) { + echo''; +} else { + $rid = $sql_crank[id]; + $newrank = $sql_crank[rank]-$rank; + $oldrank = $sql_crank[rank]; + $matchcount = $sql_crank[matches]-1; + + mysql_query("UPDATE uts_rank SET rank = $newrank, prevrank = $oldrank, matches = $matchcount WHERE id = $rid") or die(mysql_error()); + mysql_query("DELETE FROM uts_rank WHERE matches = 0") or die(mysql_error()); + + echo''; +} +echo' + + '; + $q_match = mysql_query("SELECT matchid, playerid FROM uts_player WHERE pid = '$pid' and matchid = '$matchid'") or die(mysql_error()); + while ($r_match = mysql_fetch_array($q_match)) { + mysql_query("DELETE FROM uts_killsmatrix WHERE matchid = '${r_match['matchid']}' AND (killer = '${r_match['playerid']}' OR victim = '${r_match['playerid']}')") or die(mysql_error()); + } + echo' + + + + + '; +mysql_query("DELETE FROM uts_weaponstats WHERE matchid = $matchid AND pid = $pid") or die(mysql_error()); + echo' + + + '; +mysql_query("DELETE e.* FROM uts_events as e, uts_player as p WHERE p.pid = '$pid' AND e.matchid = $matchid AND p.playerid = e.playerid AND p.matchid = e.matchid") or die(mysql_error()); + echo' + + + '; +mysql_query("DELETE FROM uts_player WHERE matchid IN ('$matchid','0') AND pid = '$pid'") or die(mysql_error()); + echo' + + + '; +mysql_query("DELETE FROM uts_weaponstats WHERE matchid IN ('$matchid','0') AND pid = '$pid'") or die(mysql_error()); + +$q_weaponstats = mysql_query("SELECT SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE pid = '$pid' GROUP BY weapon") or die(mysql_error()); +while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) { + mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='$pid', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error()); +} + echo' + + + '; + mysql_query("DELETE FROM uts_weaponstats WHERE matchid='0' AND pid='0'") or die(mysql_error()); + + $q_weaponstats = mysql_query("SELECT weapon, SUM(kills) AS kills, SUM(shots) AS shots, SUM(hits) as hits, SUM(damage) as damage, AVG(acc) AS acc FROM uts_weaponstats WHERE matchid = '0' GROUP BY weapon") or die(mysql_error()); + while ($r_weaponstats = mysql_fetch_array($q_weaponstats)) { + mysql_query("INSERT INTO uts_weaponstats SET matchid='0', pid='0', weapon='${r_weaponstats['weapon']}', kills='${r_weaponstats['kills']}', shots='${r_weaponstats['shots']}', hits='${r_weaponstats['hits']}', damage='${r_weaponstats['damage']}', acc='${r_weaponstats['acc']}'") or die(mysql_error()); + } + + echo' + + + +
Delete Player From Match ID '.$matchid.'
Amending Players Rank:Player not in rankingsDone
Removing Kill Matrix Entries:Done
Removing Player Weapon Stats:Done
Removing Player Events:Done
Removing Player From Match:Done
Amending Player Weapon Stats:Done
Amending Global Weapon Stats:Done
Match Deleted - Go Back To Admin Page
'; + +?> -- cgit