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/recalcflags.php | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 html/pages/admin/recalcflags.php (limited to 'html/pages/admin/recalcflags.php') diff --git a/html/pages/admin/recalcflags.php b/html/pages/admin/recalcflags.php new file mode 100755 index 0000000..073e648 --- /dev/null +++ b/html/pages/admin/recalcflags.php @@ -0,0 +1,72 @@ + + + +'; + +echo' + + '; + echo' + + + + +
Recalculating Countryflags
Recalculating Rankings:'; + + echo'Recalculating pinfo table...
'; + /* update pinfo table */ + $sql_pids = mysql_query("SELECT uts_pinfo.id as pid, uts_pinfo.country as country, uts_player.ip as ip FROM uts_pinfo, uts_player WHERE uts_pinfo.id = uts_player.pid GROUP BY uts_player.pid;") or die(mysql_error()); + while($sql_pid = mysql_fetch_array($sql_pids)) + { + $playercountry = strtolower(geoip_country_code_by_addr($gi,long2ip($sql_pid['ip']))); + + if ($playercountry != $sql_pid['country'] ) + { + mysql_query("UPDATE uts_pinfo SET country = '$playercountry' WHERE id = '".$sql_pid['pid']."'") or die(mysql_error()); + } + } + + echo'Recalculating player table...
'; + /* update player table */ + $sql_pids = mysql_query("SELECT pid, ip, country FROM uts_player"); + while ($sql_pid = mysql_fetch_array($sql_pids)) + { + $playercountry = strtolower(geoip_country_code_by_addr($gi,long2ip($sql_pid['ip']))); + + if ($playercountry != $sql_pid['country']) + { + mysql_query("UPDATE uts_player SET country = '$playercountry' WHERE pid = '".$sql_pid['pid']."'") or die(mysql_error()); + } + } + echo 'Done
Countryflags recalculated - Go Back To Admin Page
'; + +?> -- cgit