From 7e5c50603cbe1307d68a2b5b8ee14409e15a9dcb Mon Sep 17 00:00:00 2001 From: Matthijs Kuiper Date: Sun, 14 Jan 2018 20:08:50 +0100 Subject: Update to mysqli --- html/import.php | 80 +++++++-------- html/import/import_ass.php | 12 +-- html/import/import_bt.php | 8 +- html/import/import_ctf.php | 6 +- html/import/import_dom.php | 8 +- html/import/import_jailbreak.php | 4 +- html/import/import_killsmatrix.php | 6 +- html/import/import_lms.php | 10 +- html/import/import_pcleanup.php | 34 +++---- html/import/import_playerstuff.php | 16 +-- html/import/import_ranking.php | 12 +-- html/import/import_renderer-ctf.php | 2 +- html/import/import_renderer-dm.php | 2 +- html/import/import_renderer-dom.php | 2 +- html/import/import_renderer-preconfig.php | 29 +++--- html/import/import_weapons.php | 40 ++++---- html/includes/config.php | 2 + html/includes/ftp_class_pure.php | 4 +- html/includes/functions.php | 19 ++-- html/includes/functions_admin.php | 16 +-- html/includes/renderer-ctf.php | 34 +++---- html/includes/renderer-dm.php | 56 +++++----- html/includes/renderer-dom.php | 70 ++++++------- html/includes/renderer-general-import.php | 27 ++--- html/includes/teamstats.php | 4 +- html/includes/weaponstats.php | 4 +- html/pages/admin/check.php | 59 +++++------ html/pages/admin/dmatch.php | 34 +++---- html/pages/admin/dplayer.php | 24 ++--- html/pages/admin/dpmatch.php | 32 +++--- html/pages/admin/editgames.php | 12 +-- html/pages/admin/editgamestype.php | 36 +++---- html/pages/admin/editweapons.php | 8 +- html/pages/admin/emptydb.php | 24 ++--- html/pages/admin/ipsearch.php | 8 +- html/pages/admin/main.php | 6 +- html/pages/admin/mplayers.php | 28 ++--- html/pages/admin/mservers.php | 2 +- html/pages/admin/pban.php | 12 +-- html/pages/admin/pinfo.php | 18 ++-- html/pages/admin/plm.php | 114 ++++++++++----------- html/pages/admin/recalcflags.php | 12 +-- html/pages/admin/recalcranking.php | 6 +- html/pages/credits.php | 2 +- html/pages/dpmatch.php | 30 +++--- html/pages/graph_mbreakdown.php | 16 +-- html/pages/graph_pbreakdown.php | 12 +-- html/pages/home.php | 8 +- html/pages/maps.php | 8 +- html/pages/maps_info.php | 14 +-- html/pages/match_info_bt.php | 8 +- html/pages/match_info_charts.php | 10 +- html/pages/match_info_ctf.php | 16 +-- html/pages/match_info_killsmatrix.php | 8 +- html/pages/match_info_lms.php | 4 +- html/pages/match_info_other.php | 8 +- html/pages/match_info_other2.php | 8 +- html/pages/players.php | 4 +- html/pages/players_explain_ranking.php | 4 +- html/pages/players_info.php | 163 +++++++++++++++--------------- html/pages/players_search.php | 4 +- html/pages/rank.php | 10 +- html/pages/rank_extended.php | 4 +- html/pages/recent.php | 12 +-- html/pages/report/bbcode.php | 8 +- html/pages/report/clanbase.php | 8 +- html/pages/report_cb.php | 16 +-- html/pages/servers.php | 4 +- html/pages/servers_info.php | 8 +- html/pages/totals.php | 28 ++--- html/pages/watchlist.php | 4 +- 71 files changed, 683 insertions(+), 688 deletions(-) (limited to 'html') diff --git a/html/import.php b/html/import.php index c2bcfe6..af94cc2 100755 --- a/html/import.php +++ b/html/import.php @@ -278,16 +278,16 @@ while (false !== ($filename = readdir($logdir))) { KEY `full` (`col0` (20),`col1` (20),`col2` (20),`col3` (20),`col4` (20)) ) ENGINE=". ($import_use_heap_tables ? 'HEAP' : 'MyISAM') .";"; - $result = mysql_query($sql); + $result = mysqli_query($GLOBALS["___mysqli_link"], $sql); if ($result) break; - if (mysql_errno() == 1044 and $import_use_temporary_tables) { - echo "
WARNING: Unable to create temporary table (". mysql_error() .")
"; + if (mysqli_errno($GLOBALS["___mysqli_link"]) == 1044 and $import_use_temporary_tables) { + echo "
WARNING: Unable to create temporary table (". mysqli_error($GLOBALS["___mysqli_link"]) .")
"; echo "I'll retry without using MySQL's temporary table feature (see \$import_use_temporary_tables in config.php for details).

"; $import_use_temporary_tables = false; continue; } - die("
Unable to create the temporary table:
". mysql_error() ."

"); + die("
Unable to create the temporary table:
". mysqli_error($GLOBALS["___mysqli_link"]) ."

"); } $id = 0; @@ -327,8 +327,8 @@ while (false !== ($filename = readdir($logdir))) { $num = count($data); $row++; - for ($c=0; $c < 1; $c++) { + for ($c=0; $c < 1; $c++) { $col0 = addslashes($data[0]); $col1 = addslashes($data[1]); $col2 = addslashes($data[2]); @@ -342,7 +342,7 @@ while (false !== ($filename = readdir($logdir))) { $col4 = trim($col4, " \n\r"); $id++; - mysql_query("INSERT INTO uts_temp_$uid VALUES ($id, '$col0', '$col1', '$col2', '$col3', '$col4');") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_temp_$uid VALUES ($id, '$col0', '$col1', '$col2', '$col3', '$col4');") or die(mysqli_error($GLOBALS["___mysqli_link"])); } } fclose($handle); @@ -432,8 +432,8 @@ while (false !== ($filename = readdir($logdir))) { } else { $sql_mutators = "SELECT col3 FROM uts_temp_$uid WHERE col1 = 'game' AND col2 = 'GoodMutator'"; - $q_mutators = mysql_query($sql_mutators); - while ($r_mutators = mysql_fetch_array($q_mutators)) { + $q_mutators = mysqli_query($GLOBALS["___mysqli_link"], $sql_mutators); + while ($r_mutators = mysqli_fetch_array($q_mutators)) { $qm_mutators .= "".$r_mutators[col3].", "; } @@ -486,8 +486,8 @@ while (false !== ($filename = readdir($logdir))) { if ($r_gid) { $gid = $r_gid['id']; } else { - mysql_query("INSERT INTO uts_games SET gamename = '$gamename', name = '$gamename'") or die(mysql_error()); - $gid = mysql_insert_id(); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_games SET gamename = '$gamename', name = '$gamename'") or die(mysqli_error($GLOBALS["___mysqli_link"])); + $gid = ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_link"]))) ? false : $___mysqli_res); } // Check wheter we want to override the gametype for this match @@ -498,8 +498,8 @@ while (false !== ($filename = readdir($logdir))) { if (!isset($overriderules)) { $overriderules = array(); $sql_overriderules = "SELECT id, serverip, gamename, mutator, gid FROM uts_gamestype ORDER BY id ASC;"; - $q_overriderules = mysql_query($sql_overriderules); - while ($r_overriderules = mysql_fetch_array($q_overriderules)) { + $q_overriderules = mysqli_query($GLOBALS["___mysqli_link"], $sql_overriderules); + while ($r_overriderules = mysqli_fetch_array($q_overriderules)) { $overriderules[$r_overriderules['id']]['serverip'] = $r_overriderules['serverip']; $overriderules[$r_overriderules['id']]['gamename'] = $r_overriderules['gamename']; $overriderules[$r_overriderules['id']]['mutator'] = $r_overriderules['mutator']; @@ -544,14 +544,14 @@ while (false !== ($filename = readdir($logdir))) { // Get Teams Info $sql_tinfo = "SELECT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'TeamName' GROUP BY col4 ORDER BY col4 ASC"; - $q_tinfo = mysql_query($sql_tinfo) or die(mysql_error()); + $q_tinfo = mysqli_query($GLOBALS["___mysqli_link"], $sql_tinfo) or die(mysqli_error($GLOBALS["___mysqli_link"])); $t0info = 0; $t1info = 0; $t2info = 0; $t3info = 0; - while ($r_tinfo = mysql_fetch_array($q_tinfo)) { + while ($r_tinfo = mysqli_fetch_array($q_tinfo)) { if ($r_tinfo[col4] == "Red") { $t0info = 1; } if ($r_tinfo[col4] == "Blue") { $t1info = 1; } if ($r_tinfo[col4] == "Green") { $t2info = 1; } @@ -560,14 +560,14 @@ while (false !== ($filename = readdir($logdir))) { // Get Teamscores $sql_tscore = "SELECT col2 AS team, col3 AS score FROM uts_temp_$uid WHERE col1 = 'teamscore'"; - $q_tscore = mysql_query($sql_tscore) or die(mysql_error()); + $q_tscore = mysqli_query($GLOBALS["___mysqli_link"], $sql_tscore) or die(mysqli_error($GLOBALS["___mysqli_link"])); $t0score = 0; $t1score = 0; $t2score = 0; $t3score = 0; - while ($r_tscore = mysql_fetch_array($q_tscore)) { + while ($r_tscore = mysqli_fetch_array($q_tscore)) { if ($r_tscore['team'] == "0") $t0score = $r_tscore['score']; if ($r_tscore['team'] == "1") $t1score = $r_tscore['score']; if ($r_tscore['team'] == "2") $t2score = $r_tscore['score']; @@ -581,8 +581,8 @@ VALUES ('$gametime', '$servername', '$serverip:$serverport', '$gamename', '$gid' '$teamgame', '$mapname', '$mapfile', '$serverinfo', '$gameinfo', '$s_frags', '$s_kills', '$s_suicides', '$s_teamkills', '$s_deaths', $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; - $q_serverinfo = mysql_query($sql_serverinfo) or die(mysql_error()); - $matchid = mysql_insert_id(); // Get our Match ID + $q_serverinfo = mysqli_query($GLOBALS["___mysqli_link"], $sql_serverinfo) or die(mysqli_error($GLOBALS["___mysqli_link"])); + $matchid = ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_link"]))) ? false : $___mysqli_res); // Get our Match ID echo "Yes (ID: $matchid)\n"; if ($html) echo ''; @@ -598,9 +598,9 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; // Get List of Player IDs and Process What They Have Done $sql_player = "SELECT DISTINCT col4 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'rename' AND col4 <> ''"; - $q_player = mysql_query($sql_player) or die(mysql_error()); + $q_player = mysqli_query($GLOBALS["___mysqli_link"], $sql_player) or die(mysqli_error($GLOBALS["___mysqli_link"])); - while ($r_player = mysql_fetch_array($q_player)) { + while ($r_player = mysqli_fetch_array($q_player)) { $playerid = $r_player[col4]; // Get players last name used @@ -614,7 +614,7 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; if ($playertype == 'True' and $import_ignore_bots) { $ignored_players[] = $playername; // We do not want to know who killed and who was killed by this bot... - mysql_query("DELETE FROM uts_temp_$uid WHERE (col1 = 'kill' OR col1 = 'teamkill') AND (col2 = '$playerid' OR col4 = '$playerid');") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "DELETE FROM uts_temp_$uid WHERE (col1 = 'kill' OR col1 = 'teamkill') AND (col2 = '$playerid' OR col4 = '$playerid');") or die(mysqli_error($GLOBALS["___mysqli_link"])); if ($html) echo ""; echo "Bot:$playername "; if ($html) echo ""; @@ -640,12 +640,12 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; if ($playerbanned) { // Banned players don't have a rank. - mysql_query("DELETE FROM uts_rank WHERE pid = '$pid'"); + mysqli_query($GLOBALS["___mysqli_link"], "DELETE FROM uts_rank WHERE pid = '$pid'"); if ($import_ban_type == 2) { // We do not want to know who killed and who was killed by this banned player $ignored_players[] = $playername; - mysql_query("DELETE FROM uts_temp_$uid WHERE (col1 = 'kill' OR col1 = 'teamkill') AND (col2 = '$playerid' OR col4 = '$playerid');") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "DELETE FROM uts_temp_$uid WHERE (col1 = 'kill' OR col1 = 'teamkill') AND (col2 = '$playerid' OR col4 = '$playerid');") or die(mysqli_error($GLOBALS["___mysqli_link"])); if ($html) echo ""; echo "Banned:$playername "; if ($html) echo ""; @@ -688,8 +688,8 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; '; $sql_radjust = "SELECT pid, gid, rank FROM uts_player WHERE matchid = $matchid"; - $q_radjust = mysql_query($sql_radjust) or die(mysql_error()); - while ($r_radjust = mysql_fetch_array($q_radjust)) { + $q_radjust = mysqli_query($GLOBALS["___mysqli_link"], $sql_radjust) or die(mysqli_error($GLOBALS["___mysqli_link"])); + while ($r_radjust = mysqli_fetch_array($q_radjust)) { $pid = $r_radjust[pid]; $gid = $r_radjust[gid]; $rank = $r_radjust[rank]; @@ -702,16 +702,16 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; $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()); + mysqli_query($GLOBALS["___mysqli_link"], "UPDATE uts_rank SET rank = $newrank, prevrank = $oldrank, matches = $matchcount WHERE id = $rid") or die(mysqli_error($GLOBALS["___mysqli_link"])); } - mysql_query("DELETE FROM uts_rank WHERE matches = 0") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "DELETE FROM uts_rank WHERE matches = 0") or die(mysqli_error($GLOBALS["___mysqli_link"])); $rem_mrecord = "DELETE FROM uts_match WHERE id = $matchid"; - mysql_query($rem_mrecord); + mysqli_query($GLOBALS["___mysqli_link"], $rem_mrecord); $rem_precord = "DELETE FROM uts_player WHERE matchid = $matchid"; - mysql_query($rem_precord); + mysqli_query($GLOBALS["___mysqli_link"], $rem_precord); $rem_precord = "DELETE FROM uts_events WHERE matchid = $matchid"; - mysql_query($rem_precord); + mysqli_query($GLOBALS["___mysqli_link"], $rem_precord); } else { // Make our weapons statistics echo "\n"; @@ -738,9 +738,9 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; include("import/import_pcleanup.php"); echo "Done\n"; - if ($html) echo''; + if ($html) echo ""; - include('import/import_renderer-preconfig.php'); + include("import/import_renderer-preconfig.php"); $updategameinfo = false; if (count($ignored_players) > 0) { @@ -755,22 +755,22 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; } } if ($updategameinfo) { - mysql_query("UPDATE uts_match SET gameinfo = '$gameinfo' WHERE id = '$matchid'"); + mysqli_query($GLOBALS["___mysqli_link"], "UPDATE uts_match SET gameinfo = '$gameinfo' WHERE id = '$matchid'"); $updategameinfo = false; } if ($gamename == "Domination" || $gamename == "Domination (insta)" ) { if ($html) echo ''; echo "Generating dom graphs: "; if ($html) echo ''; - include("import/import_renderer-dom.php"); + include("import/import_renderer-dom.php"); echo "Done\n"; if ($html) echo''; - } + } else if ($gamename == "Tournament DeathMatch" || $gamename == "Tournament DeathMatch (insta)" || $gamename == "Tournament Team Game" || $gamename == "Tournament Team Game (insta)" ) { if ($html) echo ''; echo "Generating dm graphs: "; if ($html) echo ''; - include("import/import_renderer-dm.php"); + include("import/import_renderer-dm.php"); echo "Done\n"; if ($html) echo''; } @@ -778,7 +778,7 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; if ($html) echo ''; echo "Generating ctf graphs: "; if ($html) echo ''; - include("import/import_renderer-ctf.php"); + include("import/import_renderer-ctf.php"); echo "Done\n"; if ($html) echo''; } @@ -787,7 +787,7 @@ $t0info, $t1info, $t2info, $t3info, $t0score, $t1score, $t2score, $t3score);"; // Delete Temp MySQL Table $droptable = "DROP TABLE uts_temp_$uid"; - mysql_query($droptable) or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $droptable) or die(mysqli_error($GLOBALS["___mysqli_link"])); if ($html) echo''; echo "Deleting Temp MySQL Table: "; @@ -862,7 +862,7 @@ if ($files != 0) { if (rand(0, 5) == 0) { if ($html) echo '

'; echo "Optimizing tables... "; - mysql_query("OPTIMIZE TABLE uts_match, uts_player, uts_rank, uts_killsmatrix, uts_weaponstats, uts_pinfo;") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "OPTIMIZE TABLE uts_match, uts_player, uts_rank, uts_killsmatrix, uts_weaponstats, uts_pinfo;") or die(mysqli_error($GLOBALS["___mysqli_link"])); echo "Done\n"; if ($html) echo '

'; } @@ -871,7 +871,7 @@ if (rand(0, 5) == 0) { if (rand(0, 10) == 0) { if ($html) echo '

'; echo "Analyzing tables... "; - mysql_query("ANALYZE TABLE uts_match, uts_player, uts_rank, uts_killsmatrix, uts_weaponstats, uts_pinfo;") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "ANALYZE TABLE uts_match, uts_player, uts_rank, uts_killsmatrix, uts_weaponstats, uts_pinfo;") or die(mysqli_error($GLOBALS["___mysqli_link"])); echo "Done\n"; if ($html) echo '

'; } diff --git a/html/import/import_ass.php b/html/import/import_ass.php index 9539bc5..22819a1 100755 --- a/html/import/import_ass.php +++ b/html/import/import_ass.php @@ -3,32 +3,32 @@ $r_assobj = small_query("SELECT count(id) AS assobjcount FROM uts_temp_$uid WHERE col1 = 'assault_obj' AND col2 = $playerid"); $assobjcount = $r_assobj[assobjcount]; $upd_assobj = "UPDATE uts_player SET ass_obj = $assobjcount WHERE id = $playerecordid"; - mysql_query($upd_assobj) or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $upd_assobj) or die(mysqli_error($GLOBALS["___mysqli_link"])); // Get assault game code (unique code give for the 2 games played) $r_asscode = small_query("SELECT col2 FROM uts_temp_$uid WHERE col1 = 'assault_gamecode' LIMIT 0,1"); $asscode = $r_asscode[col2]; $updateasscode = "UPDATE uts_match SET assaultid = '$asscode' WHERE id = $matchid"; - mysql_query($updateasscode) or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $updateasscode) or die(mysqli_error($GLOBALS["___mysqli_link"])); // Get Which Teams Attacking $r_assteam = small_query("SELECT col2 FROM uts_temp_$uid WHERE col1 = 'assault_attacker' LIMIT 0,1"); $assteam = $r_assteam[col2]; $updateassteam = "UPDATE uts_match SET ass_att = $assteam WHERE id = $matchid;"; - mysql_query($updateassteam) or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $updateassteam) or die(mysqli_error($GLOBALS["___mysqli_link"])); // Did they do it? $sql_asswin = "SELECT col0 FROM uts_temp_$uid WHERE col1 = 'game_end' AND col2 = 'Assault succeeded!' LIMIT 0,1"; - $q_asswin = mysql_query($sql_asswin) or die(mysql_error()); + $q_asswin = mysqli_query($GLOBALS["___mysqli_link"], $sql_asswin) or die(mysqli_error($GLOBALS["___mysqli_link"])); $asswin = 0; - while ($r_asswin = mysql_fetch_array($q_asswin)) { + while ($r_asswin = mysqli_fetch_array($q_asswin)) { IF ($r_asswin[col0] != NULL ) { $asswin = 1; } } $updateasswin = "UPDATE uts_match SET ass_win = $asswin WHERE id = $matchid;"; - mysql_query($updateasswin) or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $updateasswin) or die(mysqli_error($GLOBALS["___mysqli_link"])); ?> diff --git a/html/import/import_bt.php b/html/import/import_bt.php index fe6a480..be1ea5c 100755 --- a/html/import/import_bt.php +++ b/html/import/import_bt.php @@ -1,14 +1,14 @@ $cap_speed) { $cap_speed = $r_capbt['col3']; $col0 = $r_capbt['col0']; // time @@ -34,13 +34,13 @@ $sql_eventsbt = "INSERT INTO uts_events (matchid, playerid, col0, col1, col2, col3, col4) VALUES ($matchid, $playerid, '$col0', '$col1', '$col2', '$col3', '$col4')"; - mysql_query($sql_eventsbt) or die (mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $sql_eventsbt) or die (mysqli_error($GLOBALS["___mysqli_link"])); } if ($flag_capture > 0) { $sql_playerflags = " UPDATE uts_player SET flag_capture = $flag_capture WHERE id = $playerecordid"; - mysql_query($sql_playerflags) or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $sql_playerflags) or die(mysqli_error($GLOBALS["___mysqli_link"])); } ?> diff --git a/html/import/import_ctf.php b/html/import/import_ctf.php index 206cbb0..73c1bb2 100755 --- a/html/import/import_ctf.php +++ b/html/import/import_ctf.php @@ -1,7 +1,7 @@ diff --git a/html/import/import_dom.php b/html/import/import_dom.php index 91106ac..fc00352 100755 --- a/html/import/import_dom.php +++ b/html/import/import_dom.php @@ -1,19 +1,19 @@ \ No newline at end of file diff --git a/html/import/import_jailbreak.php b/html/import/import_jailbreak.php index 6d6e0da..dded76f 100755 --- a/html/import/import_jailbreak.php +++ b/html/import/import_jailbreak.php @@ -12,11 +12,11 @@ $r_efficiency = get_dp(($r_kills / ($r_kills + $r_deaths + $r_suicides + $r_teamkills)) * 100); - mysql_query(" UPDATE uts_player + mysqli_query($GLOBALS["___mysqli_link"], " UPDATE uts_player SET ass_obj = '$r_releases', suicides = '$r_suicides', frags = '$r_frags', eff = '$r_efficiency' - WHERE id = $playerecordid;") or die(mysql_error()); + WHERE id = $playerecordid;") or die(mysqli_error($GLOBALS["___mysqli_link"])); ?> \ No newline at end of file diff --git a/html/import/import_killsmatrix.php b/html/import/import_killsmatrix.php index 433a659..cb17375 100755 --- a/html/import/import_killsmatrix.php +++ b/html/import/import_killsmatrix.php @@ -7,8 +7,8 @@ OR col1 = 'teamkill' GROUP BY col2, col4"; - $q_killmatrix = mysql_query($sql_killmatrix) or die(mysql_error()); - while ($r_killmatrix = mysql_fetch_array($q_killmatrix)) { + $q_killmatrix = mysqli_query($GLOBALS["___mysqli_link"], $sql_killmatrix) or die(mysqli_error($GLOBALS["___mysqli_link"])); + while ($r_killmatrix = mysqli_fetch_array($q_killmatrix)) { $sql = " INSERT INTO uts_killsmatrix @@ -16,7 +16,7 @@ killer = '". $r_killmatrix['killer'] ."', victim = '". $r_killmatrix['killed'] ."', kills = '". $r_killmatrix['kills'] ."';"; - mysql_query($sql) or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $sql) or die(mysqli_error($GLOBALS["___mysqli_link"])); } ?> diff --git a/html/import/import_lms.php b/html/import/import_lms.php index eb3ebd7..df752f1 100755 --- a/html/import/import_lms.php +++ b/html/import/import_lms.php @@ -13,19 +13,19 @@ $sql_eventslms = "INSERT INTO uts_events (matchid, playerid, col0, col1, col2, col3, col4) VALUES ($matchid, $playerid, '$col0', '$col1', '$col2', '$col3', '$col4')"; - mysql_query($sql_eventslms) or die (mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $sql_eventslms) or die (mysqli_error($GLOBALS["___mysqli_link"])); // Fix ttl $ttl = ($outtime[col0] - $gamestart) / ($qc_deaths[col4] + $q_suicides[col4]); - mysql_query("UPDATE uts_player SET ttl = $ttl WHERE id = $playerecordid") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "UPDATE uts_player SET ttl = $ttl WHERE id = $playerecordid") or die(mysqli_error($GLOBALS["___mysqli_link"])); } else { $disconnect = small_query("SELECT col0 FROM uts_temp_$uid WHERE col1 = 'player' AND col2 = 'Disconnect' AND col3 = $playerid"); if ((!empty($disconnect[col0])) and (intval($disconnect[col0]) < intval($gameend))) { // echo " get out time "; $outtime = $player_left - $gamestart; - $q_out = mysql_query($sql_out); + $q_out = mysqli_query($GLOBALS["___mysqli_link"], $sql_out); $col0 = $disconnect[col0]; $col1 = 'out'; $col2 = intval($disconnect[col0] - $gamestart); //time @@ -35,12 +35,12 @@ $sql_eventslms = "INSERT INTO uts_events (matchid, playerid, col0, col1, col2, col3, col4) VALUES ($matchid, $playerid, '$col0', '$col1', '$col2', '$col3', '$col4')"; - mysql_query($sql_eventslms) or die (mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $sql_eventslms) or die (mysqli_error($GLOBALS["___mysqli_link"])); // Update ttl and set score to 0 $ttl = ($disconnect[col0] - $gamestart) / ($qc_deaths[col4] + $q_suicides[col4]); - mysql_query("UPDATE uts_player SET ttl = $ttl, gamescore = 0 WHERE id = $playerecordid") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "UPDATE uts_player SET ttl = $ttl, gamescore = 0 WHERE id = $playerecordid") or die(mysqli_error($GLOBALS["___mysqli_link"])); } } ?> diff --git a/html/import/import_pcleanup.php b/html/import/import_pcleanup.php index 3e1be8a..fa8dbfb 100755 --- a/html/import/import_pcleanup.php +++ b/html/import/import_pcleanup.php @@ -2,27 +2,27 @@ $sql_tgame = small_query("SELECT teamgame FROM uts_match WHERE id = $matchid"); IF($sql_tgame == "True") { $rem_srecord = "DELETE FROM uts_player WHERE matchid = $matchid AND team > 3"; - mysql_query($rem_srecord); + mysqli_query($GLOBALS["___mysqli_link"], $rem_srecord); } $cleaned = false; // Get list of players $sql_pname = "SELECT pid, name FROM uts_player, uts_pinfo AS pi WHERE matchid = $matchid AND pid = pi.id"; -$q_pname = mysql_query($sql_pname); -while ($r_pname = mysql_fetch_array($q_pname)) { +$q_pname = mysqli_query($GLOBALS["___mysqli_link"], $sql_pname); +while ($r_pname = mysqli_fetch_array($q_pname)) { $playername = addslashes($r_pname[name]); $pid = $r_pname['pid']; // Check if player has more than 1 record - $q_ids = mysql_query("SELECT playerid FROM uts_player WHERE pid = '$pid' AND matchid = $matchid"); + $q_ids = mysqli_query($GLOBALS["___mysqli_link"], "SELECT playerid FROM uts_player WHERE pid = '$pid' AND matchid = $matchid"); - IF (mysql_num_rows($q_ids) > 1) { - $numrecords = mysql_num_rows($q_ids); + IF (mysqli_num_rows($q_ids) > 1) { + $numrecords = mysqli_num_rows($q_ids); echo $r_pname[name] .' '; // get all the ids this player had $playerids = array(); - while ($r_ids = mysql_fetch_array($q_ids)) { + while ($r_ids = mysqli_fetch_array($q_ids)) { $playerids[] = $r_ids['playerid']; } @@ -31,7 +31,7 @@ while ($r_pname = mysql_fetch_array($q_pname)) { // Fix the events table foreach ($playerids as $i => $oldplayerid) { - mysql_query("UPDATE uts_events SET playerid = $newplayerid WHERE playerid = $oldplayerid AND matchid = $matchid"); + mysqli_query($GLOBALS["___mysqli_link"], "UPDATE uts_events SET playerid = $newplayerid WHERE playerid = $oldplayerid AND matchid = $matchid"); } // Fix matchcount in ranking table @@ -46,9 +46,9 @@ while ($r_pname = mysql_fetch_array($q_pname)) { AND killer IN (". implode(",", $playerids) .") GROUP BY victim;"; - $q_kmupdate = mysql_query($sql_kmupdate); - while ($r_kmupdate = mysql_fetch_array($q_kmupdate)) { - mysql_query(" INSERT + $q_kmupdate = mysqli_query($GLOBALS["___mysqli_link"], $sql_kmupdate); + while ($r_kmupdate = mysqli_fetch_array($q_kmupdate)) { + mysqli_query($GLOBALS["___mysqli_link"], " INSERT INTO uts_killsmatrix SET matchid = $matchid, killer = $newplayerid, @@ -63,9 +63,9 @@ while ($r_pname = mysql_fetch_array($q_pname)) { AND victim IN (". implode(",", $playerids) .") GROUP BY killer;"; - $q_kmupdate = mysql_query($sql_kmupdate); - while ($r_kmupdate = mysql_fetch_array($q_kmupdate)) { - mysql_query(" INSERT + $q_kmupdate = mysqli_query($GLOBALS["___mysqli_link"], $sql_kmupdate); + while ($r_kmupdate = mysqli_fetch_array($q_kmupdate)) { + mysqli_query($GLOBALS["___mysqli_link"], " INSERT INTO uts_killsmatrix SET matchid = $matchid, killer = ${r_kmupdate['killer']}, @@ -73,7 +73,7 @@ while ($r_pname = mysql_fetch_array($q_pname)) { kills = ${r_kmupdate['kills']};"); } - mysql_query(" DELETE + mysqli_query($GLOBALS["___mysqli_link"], " DELETE FROM uts_killsmatrix WHERE matchid = $matchid AND (killer IN (". implode(",", $playerids) .") @@ -192,7 +192,7 @@ while ($r_pname = mysql_fetch_array($q_pname)) { // Remove all of this player's records $rem_precord = "DELETE FROM uts_player WHERE matchid = $matchid AND pid = '$pid'"; - mysql_query($rem_precord); + mysqli_query($GLOBALS["___mysqli_link"], $rem_precord); // Add this new record to match $upd_precord = " INSERT @@ -248,7 +248,7 @@ while ($r_pname = mysql_fetch_array($q_pname)) { pu_belt = '$r_truepinfo2[pu_belt]', pu_amp = '$r_truepinfo2[pu_amp]', rank = '$r_truepinfo2[rank]';"; - mysql_query($upd_precord) or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $upd_precord) or die(mysqli_error($GLOBALS["___mysqli_link"])); $cleaned = true; } } diff --git a/html/import/import_playerstuff.php b/html/import/import_playerstuff.php index cf80b25..90c9792 100755 --- a/html/import/import_playerstuff.php +++ b/html/import/import_playerstuff.php @@ -10,8 +10,8 @@ $pid_country = $r_pid['country']; $playerbanned = ($r_pid['banned'] == 'Y') ? true : false; } else { - mysql_query("INSERT INTO uts_pinfo SET name = '$playername'") or die(mysql_error()); - $pid = mysql_insert_id(); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_pinfo SET name = '$playername'") or die(mysqli_error($GLOBALS["___mysqli_link"])); + $pid = ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_link"]))) ? false : $___mysqli_res); $pid_country = false; $playerbanned = false; } @@ -24,7 +24,7 @@ // Did the player do first blood? IF($playerid == $firstblood) { $upd_firstblood = "UPDATE uts_match SET firstblood = '$pid' WHERE id = $matchid"; - mysql_query($upd_firstblood) or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], $upd_firstblood) or die(mysqli_error($GLOBALS["___mysqli_link"])); } // Get player's IP @@ -37,7 +37,7 @@ if ($playercountry != $pid_country) { - mysql_query("UPDATE uts_pinfo SET country = '$playercountry' WHERE id = '$pid'") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "UPDATE uts_pinfo SET country = '$playercountry' WHERE id = '$pid'") or die(mysqli_error($GLOBALS["___mysqli_link"])); } @@ -56,7 +56,7 @@ // Get Count of Pickups $sql_player7 = "SELECT col2, COUNT(col2) AS pu_count FROM uts_temp_$uid WHERE col1 = 'item_get' AND col3 = $playerid GROUP BY col2"; - $q_player7 = mysql_query($sql_player7); + $q_player7 = mysqli_query($GLOBALS["___mysqli_link"], $sql_player7); $pu_pads = 0; $pu_armour = 0; @@ -65,7 +65,7 @@ $pu_amp = 0; $pu_invis = 0; - while ($r_player7 = mysql_fetch_array($q_player7)) { + while ($r_player7 = mysqli_fetch_array($q_player7)) { // Cycle through pickups and see what the player got IF ($r_player7[col2] == "Thigh Pads") { $pu_pads = $r_player7[pu_count]; } IF ($r_player7[col2] == "Body Armor") { $pu_armour = $r_player7[pu_count]; } @@ -179,8 +179,8 @@ ttl = '$r_ttl', gamescore= '$r_score'"; - $q_playerid = mysql_query($sql_playerid) or die(mysql_error()); - $playerecordid = mysql_insert_id(); + $q_playerid = mysqli_query($GLOBALS["___mysqli_link"], $sql_playerid) or die(mysqli_error($GLOBALS["___mysqli_link"])); + $playerecordid = ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_link"]))) ? false : $___mysqli_res); ?> diff --git a/html/import/import_ranking.php b/html/import/import_ranking.php index 9ad18a2..fe6ce6c 100755 --- a/html/import/import_ranking.php +++ b/html/import/import_ranking.php @@ -46,8 +46,8 @@ // noobs and fewer for the good players. The new ranking would be based on the fastest captime. $rank_bt = 0; $sql_btmaprank = "SELECT e.col2 AS no, COUNT(e.col2) AS count FROM uts_events AS e, uts_player AS p WHERE p.pid = $pid AND p.gid = $gid AND p.playerid = e.playerid AND e.matchid = p.matchid AND e.matchid <= $matchid AND e.col2 > 0 AND e.col2 <= 5 GROUP BY e.col2"; - $q_btmaprank = mysql_query($sql_btmaprank) or die ("Can't retrieve \$q_btmaprank: ". mysql_error()); - while($r_btmaprank = mysql_fetch_assoc($q_btmaprank)) { + $q_btmaprank = mysqli_query($GLOBALS["___mysqli_link"], $sql_btmaprank) or die ("Can't retrieve \$q_btmaprank: ". mysqli_error($GLOBALS["___mysqli_link"])); + while($r_btmaprank = mysqli_fetch_assoc($q_btmaprank)) { IF ($r_btmaprank[no] == 1) { $rank_bt += $r_btmaprank[count] * 10; } elseIF ($r_btmaprank[no] == 2) { @@ -104,8 +104,8 @@ // Add new rank record if one does not exist IF($rank_id == NULL) { - mysql_query("INSERT INTO uts_rank SET time = '$r_gametime', pid = '$pid', gid = '$gid', rank = '0', matches = '0';") or die(mysql_error()); - $rank_id = mysql_insert_id(); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_rank SET time = '$r_gametime', pid = '$pid', gid = '$gid', rank = '0', matches = '0';") or die(mysqli_error($GLOBALS["___mysqli_link"])); + $rank_id = ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_link"]))) ? false : $___mysqli_res); $rank_gametime = 0; $rank_crank = 0; $rank_matches = 0; @@ -120,8 +120,8 @@ // if ($dbg) echo "", intval($rank_crank), "-", intval($rank_nrank). "-", $rank_matches, " "; // Add effective rank points given to uts_player record - mysql_query("UPDATE uts_player SET rank = $eff_rank WHERE id = $playerecordid") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "UPDATE uts_player SET rank = $eff_rank WHERE id = $playerecordid") or die(mysqli_error($GLOBALS["___mysqli_link"])); // Update the rank - mysql_query("UPDATE uts_rank SET time = '$rank_gametime', rank = '$rank_nrank', prevrank = '$rank_crank', matches = '$rank_matches' WHERE id = $rank_id;") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "UPDATE uts_rank SET time = '$rank_gametime', rank = '$rank_nrank', prevrank = '$rank_crank', matches = '$rank_matches' WHERE id = $rank_id;") or die(mysqli_error($GLOBALS["___mysqli_link"])); ?> diff --git a/html/import/import_renderer-ctf.php b/html/import/import_renderer-ctf.php index 3e49bf5..0c6db6f 100644 --- a/html/import/import_renderer-ctf.php +++ b/html/import/import_renderer-ctf.php @@ -7,7 +7,7 @@ if(($time_gameend-$time_gamestart)>300 && count(array_unique($playernames))>=2) { try { - $safe_uid = mysql_real_escape_string($uid); + $safe_uid = mysqli_real_escape_string($GLOBALS["___mysqli_link"], $uid); prepCTFdata($safe_uid); diff --git a/html/import/import_renderer-dm.php b/html/import/import_renderer-dm.php index e680bbf..a889865 100644 --- a/html/import/import_renderer-dm.php +++ b/html/import/import_renderer-dm.php @@ -7,7 +7,7 @@ if(($time_gameend-$time_gamestart)>300 && count(array_unique($playernames))>=2) { try { - $safe_uid = mysql_real_escape_string($uid); + $safe_uid = mysqli_real_escape_string($GLOBALS["___mysqli_link"], $uid); // Get relevant data list($datafrags, $derivfrags, $topFraggers,$counter,$datafragsteam,$derivfragsteam,$topTeams) = parseDMdata($safe_uid); diff --git a/html/import/import_renderer-dom.php b/html/import/import_renderer-dom.php index d680d49..4e20d1f 100644 --- a/html/import/import_renderer-dom.php +++ b/html/import/import_renderer-dom.php @@ -27,6 +27,6 @@ } // drop table - mysql_query("DROP TABLE $tableTempIdom") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "DROP TABLE $tableTempIdom") or die(mysqli_error($GLOBALS["___mysqli_link"])); } ?> \ No newline at end of file diff --git a/html/import/import_renderer-preconfig.php b/html/import/import_renderer-preconfig.php index bb83526..0cfe696 100644 --- a/html/import/import_renderer-preconfig.php +++ b/html/import/import_renderer-preconfig.php @@ -1,17 +1,18 @@ \ No newline at end of file +$safe_uid = mysqli_real_escape_string($GLOBALS["___mysqli_link"], $uid); + +// Get relevant info +$playerinfo = getPlayerTeam($uid); +$playernames = $playerinfo[0]; +$playerteams = $playerinfo[1]; +$playernumberofteams = $playerinfo[2]; + +$time_gameinfo = getGameStartEndRatio($uid); +$time_gamestart = $time_gameinfo[0]; +$time_gameend = $time_gameinfo[1]; +$time_ratio_correction = $time_gameinfo[2]; + +?> diff --git a/html/import/import_weapons.php b/html/import/import_weapons.php index 5d59a3f..3e6ed14 100755 --- a/html/import/import_weapons.php +++ b/html/import/import_weapons.php @@ -3,8 +3,8 @@ // Read all available weapons, we'll need them later if (!isset($weaponnames)) { $sql_weaponnames = "SELECT id, name FROM uts_weapons"; - $q_weaponnames = mysql_query($sql_weaponnames); - while ($r_weaponnames = mysql_fetch_array($q_weaponnames)) { + $q_weaponnames = mysqli_query($GLOBALS["___mysqli_link"], $sql_weaponnames); + while ($r_weaponnames = mysqli_fetch_array($q_weaponnames)) { $weaponnames[$r_weaponnames['name']] = $r_weaponnames['id']; } } @@ -19,17 +19,17 @@ $sql_weapons = " SELECT col2 AS player, OR col1 = 'teamkill' GROUP BY weaponname, player"; -$q_weapons = mysql_query($sql_weapons) or die(mysql_error()); +$q_weapons = mysqli_query($GLOBALS["___mysqli_link"], $sql_weapons) or die(mysqli_error($GLOBALS["___mysqli_link"])); $weapons = array(); -while ($r_weapons = mysql_fetch_array($q_weapons)) { +while ($r_weapons = mysqli_fetch_array($q_weapons)) { // Get the wepon's id or assign a new one if (empty($r_weapons['weaponname'])) continue; if (isset($weaponnames[$r_weapons['weaponname']])) { $weaponid = $weaponnames[$r_weapons['weaponname']]; } else { - mysql_query("INSERT INTO uts_weapons SET name = '". addslashes($r_weapons['weaponname']) ."'") or die(mysql_error()); - $weaponid = mysql_insert_id(); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_weapons SET name = '". addslashes($r_weapons['weaponname']) ."'") or die(mysqli_error($GLOBALS["___mysqli_link"])); + $weaponid = ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_link"]))) ? false : $___mysqli_res); $weaponnames[$r_weapons['weaponname']] = $weaponid; } @@ -60,15 +60,15 @@ $sql_weapons = " SELECT col1 AS type, FROM uts_temp_$uid WHERE col1 LIKE 'weap_%'"; -$q_weapons = mysql_query($sql_weapons) or die(mysql_error()); -while ($r_weapons = mysql_fetch_array($q_weapons)) { +$q_weapons = mysqli_query($GLOBALS["___mysqli_link"], $sql_weapons) or die(mysqli_error($GLOBALS["___mysqli_link"])); +while ($r_weapons = mysqli_fetch_array($q_weapons)) { // Get the wepon's id or assign a new one if (empty($r_weapons['weaponname'])) continue; if (isset($weaponnames[$r_weapons['weaponname']])) { $weaponid = $weaponnames[$r_weapons['weaponname']]; } else { - mysql_query("INSERT INTO uts_weapons SET name = '". addslashes($r_weapons['weaponname']) ."'") or die(mysql_error()); - $weaponid = mysql_insert_id(); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_weapons SET name = '". addslashes($r_weapons['weaponname']) ."'") or die(mysqli_error($GLOBALS["___mysqli_link"])); + $weaponid = ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_link"]))) ? false : $___mysqli_res); $weaponnames[$r_weapons['weaponname']] = $weaponid; } @@ -99,7 +99,7 @@ $s_weapons = array(); foreach($weapons as $playerid => $weapon) { foreach($weapon as $weaponid => $infos) { if ($infos['weap_kills'] == 0 and $infos['weap_shotcount'] == 0) continue; - mysql_query(" INSERT + mysqli_query($GLOBALS["___mysqli_link"], " INSERT INTO uts_weaponstats SET matchid = '$matchid', pid = '$playerid', @@ -108,7 +108,7 @@ foreach($weapons as $playerid => $weapon) { shots = '${infos['weap_shotcount']}', hits= '${infos['weap_hitcount']}', damage = '${infos['weap_damagegiven']}', - acc = '". round($infos['weap_accuracy'], 2) ."';") or die(mysql_error()); + acc = '". round($infos['weap_accuracy'], 2) ."';") or die(mysqli_error($GLOBALS["___mysqli_link"])); // Summarize totals for this match if (!isset($s_weapons[$weaponid]['weap_kills'])) { @@ -141,7 +141,7 @@ foreach($weapons as $playerid => $weapon) { AND weapon = '$weaponid'"); // No -> create if (!$r_pstat) { - mysql_query(" INSERT + mysqli_query($GLOBALS["___mysqli_link"], " INSERT INTO uts_weaponstats SET matchid = '0', pid = '$playerid', @@ -150,10 +150,10 @@ foreach($weapons as $playerid => $weapon) { shots = '${infos['weap_shotcount']}', hits= '${infos['weap_hitcount']}', damage = '${infos['weap_damagegiven']}', - acc = '". round($infos['weap_accuracy'], 2) ."';") or die(mysql_error()); + acc = '". round($infos['weap_accuracy'], 2) ."';") or die(mysqli_error($GLOBALS["___mysqli_link"])); // Yes -> update } else { - mysql_query(" UPDATE uts_weaponstats + mysqli_query($GLOBALS["___mysqli_link"], " UPDATE uts_weaponstats SET weapon = '$weaponid', kills = kills + '${infos['weap_kills']}', shots = shots + '${infos['weap_shotcount']}', @@ -162,7 +162,7 @@ foreach($weapons as $playerid => $weapon) { acc = (acc + '". round($infos['weap_accuracy'], 2) ."') / 2 WHERE matchid = '0' AND pid = '$playerid' - AND weapon = '$weaponid';") or die(mysql_error()); + AND weapon = '$weaponid';") or die(mysqli_error($GLOBALS["___mysqli_link"])); } } } @@ -178,7 +178,7 @@ foreach($s_weapons as $weaponid => $infos) { AND weapon = '$weaponid'"); // No -> create if (!$r_pstat) { - mysql_query(" INSERT + mysqli_query($GLOBALS["___mysqli_link"], " INSERT INTO uts_weaponstats SET matchid = '0', pid = '0', @@ -187,10 +187,10 @@ foreach($s_weapons as $weaponid => $infos) { shots = '${infos['weap_shotcount']}', hits= '${infos['weap_hitcount']}', damage = '${infos['weap_damagegiven']}', - acc = '". round($infos['weap_accuracy'], 2) ."';") or die(mysql_error()); + acc = '". round($infos['weap_accuracy'], 2) ."';") or die(mysqli_error($GLOBALS["___mysqli_link"])); // Yes -> update } else { - mysql_query(" UPDATE uts_weaponstats + mysqli_query($GLOBALS["___mysqli_link"], " UPDATE uts_weaponstats SET weapon = '$weaponid', kills = kills + '${infos['weap_kills']}', shots = shots + '${infos['weap_shotcount']}', @@ -199,7 +199,7 @@ foreach($s_weapons as $weaponid => $infos) { acc = (acc + '". round($infos['weap_accuracy'], 2) ."') / 2 WHERE matchid = '0' AND pid = '0' - AND weapon = '$weaponid';") or die(mysql_error()); + AND weapon = '$weaponid';") or die(mysqli_error($GLOBALS["___mysqli_link"])); } } diff --git a/html/includes/config.php b/html/includes/config.php index 77d42fa..2e5a8e1 100755 --- a/html/includes/config.php +++ b/html/includes/config.php @@ -182,6 +182,7 @@ $ftp_passive[$i] = true; // Use passive transfer mode for this connection? $ftp_delete[$i] = true; // Delete logs after download? */ + // This section is for stats graphs as of version 4.3 $renderer_folder = "renderings"; $renderer_width = 350; @@ -239,4 +240,5 @@ define("RENDERER_CHART_FRAGS_PLAYERNORMAL5", 97); define("RENDERER_CHART_ITEMS_TEAMPICKUPS", 100); define("RENDERER_CHART_ITEMS_PLAYERPICKUPS", 101); define("RENDERER_CHART_ITEMS_AMPRUNS", 102); + ?> diff --git a/html/includes/ftp_class_pure.php b/html/includes/ftp_class_pure.php index e7806db..4ec345e 100644 --- a/html/includes/ftp_class_pure.php +++ b/html/includes/ftp_class_pure.php @@ -1,5 +1,5 @@ // http://www.phpclasses.org/browse/package/1743.html // License: Free for non-commercial use @@ -189,4 +189,4 @@ class ftp extends ftp_base { } } } -?> \ No newline at end of file +?> diff --git a/html/includes/functions.php b/html/includes/functions.php index 93614f7..d060edd 100755 --- a/html/includes/functions.php +++ b/html/includes/functions.php @@ -1,7 +1,6 @@ '. htmlentities($r_game['name'] .' ('. $r_game['gamename'] .')') .''; @@ -179,8 +179,8 @@ function adminselect(&$options) { if (isset($var['wheregid'])) { $sql_server = "SELECT id, servername, serverip FROM uts_match WHERE gid = '". $values[$var['wheregid']] ."' GROUP BY servername, serverip ORDER BY servername ASC"; } - $q_server = mysql_query($sql_server) or die(mysql_error()); - while ($r_server = mysql_fetch_array($q_server)) { + $q_server = mysqli_query($GLOBALS["___mysqli_link"], $sql_server) or die(mysqli_error($GLOBALS["___mysqli_link"])); + while ($r_server = mysqli_fetch_array($q_server)) { if (isset($var['exclude']) and $r_server['id'] == $values[$var['exclude']]) continue; $selected = (isset($values[$var['name']]) and $r_server['id'] == $values[$var['name']]) ? 'selected' : ''; echo ''; @@ -216,8 +216,8 @@ function adminselect(&$options) { if (isset($var['wheregid'])) { $sql_player = "SELECT pi.id, pi.name FROM uts_player p, uts_pinfo pi WHERE p.pid = pi.id AND p.gid = '". $values[$var['wheregid']] ."' $where_extra GROUP BY p.id ORDER BY pi.name ASC"; } - $q_player = mysql_query($sql_player) or die(mysql_error()); - while ($r_player = mysql_fetch_array($q_player)) { + $q_player = mysqli_query($GLOBALS["___mysqli_link"], $sql_player) or die(mysqli_error($GLOBALS["___mysqli_link"])); + while ($r_player = mysqli_fetch_array($q_player)) { if (isset($var['exclude']) and $r_player['id'] == $values[$var['exclude']]) continue; $selected = (isset($values[$var['name']]) and $r_player['id'] == $values[$var['name']]) ? 'selected' : ''; echo ''; @@ -248,8 +248,8 @@ function adminselect(&$options) { if (isset($var['whereplayer'])) { $sql_match = "SELECT m.id AS id, m.time AS time, m.serverip AS serverip, m.mapfile AS mapfile FROM uts_match m, uts_player p WHERE pid = '". $values[$var['whereplayer']] ."' AND p.matchid = m.id ORDER BY time DESC"; } - $q_match = mysql_query($sql_match) or die(mysql_error()); - while ($r_match = mysql_fetch_array($q_match)) { + $q_match = mysqli_query($GLOBALS["___mysqli_link"], $sql_match) or die(mysqli_error($GLOBALS["___mysqli_link"])); + while ($r_match = mysqli_fetch_array($q_match)) { if (isset($var['exclude']) and $r_match['id'] == $values[$var['exclude']]) continue; $selected = (isset($values[$var['name']]) and $r_match['id'] == $values[$var['name']]) ? 'selected' : ''; echo ''; diff --git a/html/includes/renderer-ctf.php b/html/includes/renderer-ctf.php index 9e0cef3..b7cefc1 100644 --- a/html/includes/renderer-ctf.php +++ b/html/includes/renderer-ctf.php @@ -13,10 +13,10 @@ function renderScoreGraph($uid) { global $playernumberofteams; global $playerteams; - $uid = mysql_real_escape_string($uid); + $uid = mysqli_real_escape_string($GLOBALS["___mysqli_link"], $uid); // Get all frags related events + start & end - $q_frags = mysql_query("SELECT * FROM `uts_temp_$uid` WHERE col0>=".mysql_real_escape_string($time_gamestart)." ORDER BY id ASC") or die(mysql_error()); + $q_frags = mysqli_query($GLOBALS["___mysqli_link"], "SELECT * FROM `uts_temp_$uid` WHERE col0>=".mysqli_real_escape_string($GLOBALS["___mysqli_link"], $time_gamestart)." ORDER BY id ASC") or die(mysqli_error($GLOBALS["___mysqli_link"])); // init caps/grabs array $caps = array(); @@ -41,7 +41,7 @@ function renderScoreGraph($uid) { } $counter = 1; - while($data = mysql_fetch_array($q_frags)) { + while($data = mysqli_fetch_array($q_frags)) { // Collect data from utstats own table $r_id = $data[0]; @@ -125,16 +125,16 @@ function renderScoreGraph($uid) { } // Save team score over team for teams - mysql_query("INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_CTF_TEAMSCORE.", - '".mysql_real_escape_string(gzencode(serialize(array($grabs,$caps))))."', - '".mysql_real_escape_string(gzencode(serialize($teamLabels)))."')") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_CTF_TEAMSCORE.", + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize(array($grabs,$caps))))."', + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize($teamLabels)))."')") or die(mysqli_error($GLOBALS["___mysqli_link"])); $labelsBreakdown = array('caps','close','base','mid','enemy base'); // Save team score over team for teams - mysql_query("INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_CTF_GRABBREAKDOWN.", - '".mysql_real_escape_string(gzencode(serialize(array($flagcap,$flagclose,$flagbase,$flagmid,$flagnmybase))))."', - '".mysql_real_escape_string(gzencode(serialize($labelsBreakdown)))."')") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_CTF_GRABBREAKDOWN.", + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize(array($flagcap,$flagclose,$flagbase,$flagmid,$flagnmybase))))."', + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize($labelsBreakdown)))."')") or die(mysqli_error($GLOBALS["___mysqli_link"])); } @@ -163,16 +163,16 @@ function analyseCap($uid, $capTime, $capPlayer,$capTeam, $capId) { $event[1]['flag_captured'] = array('id' => 0, 'time' => 0, 'player' => ''); // Get grab time for both teams related to this cap. Query of the month award. - $q_grabs = mysql_query("SELECT f.id AS id, f.col0 AS gtime, f.col1 AS event, f.col2 AS player, f.col3 AS team + $q_grabs = mysqli_query($GLOBALS["___mysqli_link"], "SELECT f.id AS id, f.col0 AS gtime, f.col1 AS event, f.col2 AS player, f.col3 AS team FROM ( - SELECT col3, col1, MAX( col0 ) AS xgtime FROM `uts_temp_$uid` WHERE (col1 = 'flag_taken' OR col1 = 'flag_returned' OR col1 = 'flag_captured') AND id<".mysql_real_escape_string($capId)." GROUP BY col3,col1 ORDER BY col3 DESC + SELECT col3, col1, MAX( col0 ) AS xgtime FROM `uts_temp_$uid` WHERE (col1 = 'flag_taken' OR col1 = 'flag_returned' OR col1 = 'flag_captured') AND id<".mysqli_real_escape_string($GLOBALS["___mysqli_link"], $capId)." GROUP BY col3,col1 ORDER BY col3 DESC ) AS x INNER JOIN `uts_temp_$uid` AS f - on f.col3 = x.col3 AND f.col1 = x.col1 AND f.col0 = x.xgtime") or die(mysql_error()); + on f.col3 = x.col3 AND f.col1 = x.col1 AND f.col0 = x.xgtime") or die(mysqli_error($GLOBALS["___mysqli_link"])); // Only continue if you have at least one event (should be at least flag_taken for this cap) - if(mysql_num_rows($q_grabs) >0) { + if(mysqli_num_rows($q_grabs) >0) { - while($r_grabs = mysql_fetch_array($q_grabs)) { + while($r_grabs = mysqli_fetch_array($q_grabs)) { // Ugly code to fix bug where sometimes 20 or 14 is imported instead of 0 and 1 respectively $fixedteam = ($r_grabs['team']==20)?0:$r_grabs['team']; $fixedteam = ($fixedteam==14)?1:$fixedteam; @@ -190,7 +190,7 @@ function analyseCap($uid, $capTime, $capPlayer,$capTeam, $capId) { // Only register as cherry pick if previous run was at least 10 sec, otherwise it's not really a hcerry pick but just a subsequent grab if($event[$capTeam]['flag_returned']['time']>0 && ($event[$capTeam]['flag_taken']['time']-$event[$capTeam]['flag_returned']['time'])<4) { - $prevRunTime = small_query("SELECT MAX( col0 ) as gtime FROM `uts_temp_$uid` WHERE id<".mysql_real_escape_string($event[$capTeam]['flag_returned']['id'])." AND col1='flag_taken' AND col3='".(1-$capTeam)."'") or die(mysql_error()); + $prevRunTime = small_query("SELECT MAX( col0 ) as gtime FROM `uts_temp_$uid` WHERE id<".mysqli_real_escape_string($GLOBALS["___mysqli_link"], $event[$capTeam]['flag_returned']['id'])." AND col1='flag_taken' AND col3='".(1-$capTeam)."'") or die(mysqli_error($GLOBALS["___mysqli_link"])); if(($event[$capTeam]['flag_returned']['time'] - $prevRunTime[0]) > 10) $cherrypickDone = true; @@ -207,7 +207,7 @@ function analyseCap($uid, $capTime, $capPlayer,$capTeam, $capId) { if($event[$capTeam]['flag_taken']['player'] == $capPlayer) { // Second check is to see no pickups were done during this run - if(small_count("SELECT * FROM `uts_temp_$uid` WHERE col1 = 'flag_pickedup' AND col3 = '".(1-$capTeam)."' AND id<".mysql_real_escape_string($capId)." AND id>".mysql_real_escape_string($event[$capTeam]['flag_taken']['id'])) == 0) { + if(small_count("SELECT * FROM `uts_temp_$uid` WHERE col1 = 'flag_pickedup' AND col3 = '".(1-$capTeam)."' AND id<".mysqli_real_escape_string($GLOBALS["___mysqli_link"], $capId)." AND id>".mysqli_real_escape_string($GLOBALS["___mysqli_link"], $event[$capTeam]['flag_taken']['id'])) == 0) { $solocap = "
Solo cap"; @@ -236,7 +236,7 @@ Prep temporary database for CTF parsing function prepCTFdata($safe_uid) { // Replace time-out return by normal return - mysql_query("UPDATE `uts_temp_$safe_uid` SET col1='flag_returned', col2=(@temp:=col2),col2='-1',col3=@temp WHERE col1='flag_returned_timeout'") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "UPDATE `uts_temp_$safe_uid` SET col1='flag_returned', col2=(@temp:=col2),col2='-1',col3=@temp WHERE col1='flag_returned_timeout'") or die(mysqli_error($GLOBALS["___mysqli_link"])); } diff --git a/html/includes/renderer-dm.php b/html/includes/renderer-dm.php index 8e9f439..a7c2b23 100644 --- a/html/includes/renderer-dm.php +++ b/html/includes/renderer-dm.php @@ -21,25 +21,25 @@ function renderFragBarsTeams($datafragsteam,$derivfragsteam,$topTeams,$counter) } // Save net frags in db for first 2 teams - mysql_query("INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_FRAGS_TEAMDERIV.", - '".mysql_real_escape_string(gzencode(serialize(array($netfragsteam,$datafragsteam))))."', - '".mysql_real_escape_string(gzencode(serialize($teamLabels)))."')") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_FRAGS_TEAMDERIV.", + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize(array($netfragsteam,$datafragsteam))))."', + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize($teamLabels)))."')") or die(mysqli_error($GLOBALS["___mysqli_link"])); } else { // Save team score over team for teams - mysql_query("INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_FRAGS_TEAMSCORE.", - '".mysql_real_escape_string(gzencode(serialize($datafragsteam)))."', - '".mysql_real_escape_string(gzencode(serialize($teamLabels)))."')") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_FRAGS_TEAMSCORE.", + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize($datafragsteam)))."', + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize($teamLabels)))."')") or die(mysqli_error($GLOBALS["___mysqli_link"])); } // Generate normalized data (vs #2) & store it $normalfragsteam = normalizeDMdata($datafragsteam,$topTeams,$counter); - mysql_query("INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_FRAGS_TEAMNORMAL.", - '".mysql_real_escape_string(gzencode(serialize($normalfragsteam)))."', - '".mysql_real_escape_string(gzencode(serialize($teamLabels)))."')") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_FRAGS_TEAMNORMAL.", + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize($normalfragsteam)))."', + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize($teamLabels)))."')") or die(mysqli_error($GLOBALS["___mysqli_link"])); } @@ -71,16 +71,16 @@ function renderFragBars($datafrags, $derivfrags, $topFraggers,$counter) { $netfrags[1][$i] = $netfrags[1][$i]>0 ? $netfrags[1][$i] : 0; } - mysql_query("INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_FRAGS_PLAYERDERIV.", - '".mysql_real_escape_string(gzencode(serialize(array($netfrags,$datafragschunks[0]))))."', - '".mysql_real_escape_string(gzencode(serialize($topFraggersLabels[0])))."')") or die(mysql_error()); + mysqli_query($GLOBALS["___mysqli_link"], "INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_FRAGS_PLAYERDERIV.", + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize(array($netfrags,$datafragschunks[0]))))."', + '".mysqli_real_escape_string($GLOBALS["___mysqli_link"], gzencode(serialize($topFraggersLabels[0])))."')") or die(mysqli_error($GLOBALS["___mysqli_link"])); } else { // Generate graph for player 1 to 4 - mysql_query("INSERT INTO uts_chartdata (mid,chartid,data,labels) VALUES (".$matchid.", ".RENDERER_CHART_FRAGS_PLAYERSCORE.", - '".mysql_real_escape_string(gzencode(seriali