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/plm.php | 329 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 329 insertions(+) create mode 100755 html/pages/admin/plm.php (limited to 'html/pages/admin/plm.php') diff --git a/html/pages/admin/plm.php b/html/pages/admin/plm.php new file mode 100755 index 0000000..68992e2 --- /dev/null +++ b/html/pages/admin/plm.php @@ -0,0 +1,329 @@ +Player merging tool

'; +echo "

Merge ip's - Merge ip's, limited on range - Manage ignored ip's - Manage ignored ip's - only range

"; + +// CASE: MANAGE IGNORED IPS +if($_GET['manignore'] == "true") { + if($_POST['submit'] == "Remove from ignored list") { + echo "

Stopped ignore ip's

"; + foreach($_POST as $key=>$value) { + if($key !='submit') { + $key = mysql_real_escape_string(str_replace("_",".",$key)); + $query = "DELETE FROM uts_ignoreips WHERE ip = (INET_ATON('".$key."'))"; + mysql_query($query) or die(mysql_error()); + echo "
$key"; + } + } + } else if($_GET['onlyrange'] == "true") { + if($_POST['submit'] == "Confirm") { + echo '

Ignored ip\'s in range '.htmlentities($_POST['from']).' to '.htmlentities($_POST['to']).'
If you want to stop ignoring some ip\'s, because for example you accidently ignored these, check these and press the button at the lower end to confirm this

'; + echo '
'; + + $from = mysql_real_escape_string($_POST['from']); + $to = mysql_real_escape_string($_POST['to']); + + $ignore_ips = mysql_query("SELECT ip FROM uts_ignoreips WHERE ip >= INET_ATON('$from') AND ip <= INET_ATON('$to') ORDER BY ip ASC"); + + if(mysql_num_rows($ignore_ips) > 0) { + while ($r_pipcheck = mysql_fetch_array($ignore_ips)) { + + $playerip = $r_pipcheck[ip]; + $trueplayerip = long2ip($playerip); + $pidcount = $r_pipcheck[pidcount]; + + echo "
$trueplayerip"; + + // Query for player names and ids associated to that ip during the cycle + $sql_pcheck = "SELECT pi.id, pi.name, pi.country, p.pid, p.ip FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country"; + $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error()); + while ($r_pcheck = mysql_fetch_array($q_pcheck)) { + echo '
'.FormatPlayerName($r_pcheck[country], $r_pcheck['pid'], $r_pcheck['name']).' '; + } + echo '
'; + } + echo '
'; + } else { + echo "

No ignored ip's found

"; + } + } else { + echo "

Ignored ip's in range: Enter range to filter on

"; + echo '
'; + echo '
Ranging from to '; + echo '

'; + } + } else { + echo '

Ignored ip\'s
If you want to stop ignoring some ip\'s, because for example you accidently ignored these, check these and press the button at the lower end to confirm this

'; + echo '
'; + + $ignore_ips = mysql_query("SELECT ip FROM uts_ignoreips ORDER BY ip ASC"); + if(mysql_num_rows($ignore_ips) > 0) { + while ($r_pipcheck = mysql_fetch_array($ignore_ips)) { + + $playerip = $r_pipcheck[ip]; + $trueplayerip = long2ip($playerip); + $pidcount = $r_pipcheck[pidcount]; + + echo "
$trueplayerip"; + + // Query for player names and ids associated to that ip during the cycle + $sql_pcheck = "SELECT pi.id, pi.name, pi.country, p.pid, p.ip FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country"; + $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error()); + while ($r_pcheck = mysql_fetch_array($q_pcheck)) { + echo '
'.FormatPlayerName($r_pcheck[country], $r_pcheck['pid'], $r_pcheck['name']).' '; + } + echo '
'; + } + echo '
'; + } else { + echo "

No ignored ip's found

"; + } + } + +// CASE: IGNORE SUBMITTED IP'S +} else if($_POST['submit'] == "ignore") { + echo "

Ignored ips

"; + foreach($_POST as $key=>$value) { + if($key !='submit') { + $key = mysql_real_escape_string(str_replace("_",".",$key)); + $query = "INSERT INTO uts_ignoreips (ip) VALUES (INET_ATON('".$key."'))"; + mysql_query($query) or die(mysql_error()); + echo "
$key"; + } + } + echo "
"; + +// CASE: SHOW NICKS WITH GIVEN SHARED IP +} else if(substr($_POST['submit'],0,8) == "merge - ") { + echo "

Merge nicks with shared ip

"; + + $ip = mysql_real_escape_string(str_replace("_",".",substr($_POST['submit'],8))); + $sql_pipcheck = "SELECT ip, COUNT(DISTINCT pid) AS pidcount FROM uts_player WHERE ip = INET_ATON('$ip') GROUP BY ip ORDER BY ip ASC"; + $q_pipcheck = mysql_query($sql_pipcheck) or die(mysql_error()); + while ($r_pipcheck = mysql_fetch_array($q_pipcheck)) { + + $playerip = $r_pipcheck[ip]; + $trueplayerip = long2ip($playerip); + $pidcount = $r_pipcheck[pidcount]; + + // If there is more than one pid associated to an IP ... + IF ($pidcount > 1 ) { + echo '
'; + echo "
$trueplayerip"; + + // Query for player names and ids associated to that ip during the cycle + $sql_pcheck = "SELECT pi.id, pi.name, pi.country, p.pid, p.ip FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country"; + + $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error()); + while ($r_pcheck = mysql_fetch_array($q_pcheck)) { + echo '
'.FormatPlayerName($r_pcheck[country], $r_pcheck['pid'], $r_pcheck['name']).' '; + $options .= ''; + } + echo '

Merge to: '; + echo "
"; + echo '
'; + } + } + +// CASE: MERGE NICKS WITH SHARED IP +} else if($_POST['submit'] == "Player merge") { + echo "

Merging nicks with shared ip

"; + + $ip = mysql_real_escape_string(str_replace("_",".",$_POST['ip'])); + $merge_to_pid = mysql_real_escape_string($_POST['merge_to']); + $sql_pipcheck = "SELECT ip, COUNT(DISTINCT pid) AS pidcount FROM uts_player WHERE ip = INET_ATON('$ip') GROUP BY ip ORDER BY ip ASC"; + $q_pipcheck = mysql_query($sql_pipcheck) or die(mysql_error()); + while ($r_pipcheck = mysql_fetch_array($q_pipcheck)) { + + $playerip = $r_pipcheck[ip]; + $trueplayerip = long2ip($playerip); + $pidcount = $r_pipcheck[pidcount]; + + // If there is more than one pid associated to an IP ... + IF ($pidcount > 1 ) { + echo "$trueplayerip

merge:
"; + + // Query for player names and ids associated to that ip during the cycle + $sql_pcheck = "SELECT p.pid FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country"; + + $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error()); + $i=0; + while ($r_pcheck = mysql_fetch_array($q_pcheck)) { + if($r_pcheck['pid'] != $merge_to_pid) { + $pid_from[$i] = $r_pcheck['pid']; + echo $pid_from[$i].'
'; + $i++; + } + } + echo '
merge to: '.$merge_to_pid; + } + } + if($debug) echo "
-- started merging"; + for($j=0;$j -- merging ended"; + +// CASE: SHOW ALL IP'S LINKED TO MORE THAN ONE NICK - ONLY RANGE +} else if($_GET['onlyrange'] == "true") { + if($_POST['submit'] == "Confirm") { + echo "

Showing all ip's in range ".htmlentities($_POST['from'])." to ".htmlentities($_POST['to'])."
If you want to ignore some ip's, because for example different but unrelated nicks are associated with it, check these and press the button at the lower end to confirm this

"; + $from = mysql_real_escape_string($_POST['from']); + $to = mysql_real_escape_string($_POST['to']); + + $ignore_ips = mysql_query("SELECT ip FROM uts_ignoreips WHERE ip >= INET_ATON('$from') AND ip <= INET_ATON('$to')"); + $extended_query = "WHERE ip >= INET_ATON('$from') AND ip <= INET_ATON('$to')"; + $i=0; + while($ignore_ips_array = mysql_fetch_array($ignore_ips)) { + $ip = $ignore_ips_array[0]; + $extended_query .= " AND "; + $extended_query .= "ip <> '".$ip."'"; + $i++; + } + + echo '
'; + + + // Query for list of unique ips and player ids + $sql_pipcheck = "SELECT ip, COUNT(DISTINCT pid) AS pidcount FROM uts_player ".$extended_query." GROUP BY ip ORDER BY ip ASC"; + $q_pipcheck = mysql_query($sql_pipcheck) or die(mysql_error()); + if(mysql_num_rows($q_pipcheck) > 0) { + while ($r_pipcheck = mysql_fetch_array($q_pipcheck)) { + + $playerip = $r_pipcheck[ip]; + $trueplayerip = long2ip($playerip); + $pidcount = $r_pipcheck[pidcount]; + + // If there is more than one pid associated to an IP ... + IF ($pidcount > 1 ) { + + echo "
$trueplayerip"; + + // Query for player names and ids associated to that ip during the cycle + $sql_pcheck = "SELECT pi.id, pi.name, pi.country, p.pid, p.ip FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country"; + $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error()); + while ($r_pcheck = mysql_fetch_array($q_pcheck)) { + echo '
'.FormatPlayerName($r_pcheck[country], $r_pcheck['pid'], $r_pcheck['name']).' '; + } + echo "
"; + echo '
'; + } + } + + + echo '
'; + } else { + echo "


No ip's found with more than one nick linked to it and which are not ignored and are in this range

"; + } + + } else { + echo "

Showing all ip's in range - Enter range to filter on

"; + echo '
'; + echo '
Ranging from to '; + echo '

'; + } + +// CASE: SHOW ALL IP'S LINKED TO MORE THAN ONE NICK +} else { + echo "

IP's linked with more than one nick
If you want to ignore some ip's, because for example different but unrelated nicks are associated with it, check these and press the button at the lower end to confirm this

"; + + $ignore_ips = mysql_query("SELECT ip FROM uts_ignoreips"); + $extended_query = ""; + $i=0; + while($ignore_ips_array = mysql_fetch_array($ignore_ips)) { + $ip = $ignore_ips_array[0]; + if($i==0) + $extended_query = " WHERE "; + else + $extended_query .= " AND "; + $extended_query .= "ip <> '".$ip."'"; + $i++; + } + + echo '
'; + + + // Query for list of unique ips and player ids + $sql_pipcheck = "SELECT ip, COUNT(DISTINCT pid) AS pidcount FROM uts_player ".$extended_query." GROUP BY ip ORDER BY ip ASC"; + $q_pipcheck = mysql_query($sql_pipcheck) or die(mysql_error()); + if(mysql_num_rows($q_pipcheck) > 0) { + while ($r_pipcheck = mysql_fetch_array($q_pipcheck)) { + + $playerip = $r_pipcheck[ip]; + $trueplayerip = long2ip($playerip); + $pidcount = $r_pipcheck[pidcount]; + + // If there is more than one pid associated to an IP ... + IF ($pidcount > 1 ) { + + echo "
$trueplayerip"; + + // Query for player names and ids associated to that ip during the cycle + $sql_pcheck = "SELECT pi.id, pi.name, pi.country, p.pid, p.ip FROM uts_pinfo AS pi, uts_player AS p WHERE pi.id = p.pid AND p.ip = $playerip GROUP BY pi.id, pi.name, p.pid, p.ip, pi.country"; + $q_pcheck = mysql_query($sql_pcheck) or die(mysql_error()); + while ($r_pcheck = mysql_fetch_array($q_pcheck)) { + echo '
'.FormatPlayerName($r_pcheck[country], $r_pcheck['pid'], $r_pcheck['name']).' '; + } + echo "
"; + echo '
'; + } + } + echo '
'; + } else { + echo "


No ip's found with more than one nick linked to it and which are not ignored

"; + } +} + +// If debugmode is on, determine end time & output execution time +if($debug) { + $time = microtime(); + $time = explode(" ", $time); + $time = $time[1] + $time[0]; + $endtime = $time; + $totaltime = ($endtime - $begintime); + echo "
execution time: $totaltime"; +} +?> \ No newline at end of file -- cgit