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/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 +++++++++++++++---------------- 15 files changed, 96 insertions(+), 95 deletions(-) (limited to 'html/import') 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"])); } } -- cgit