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"; } ?>