PageRenderTime 24ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/html/pages/admin/ipsearch.php

https://github.com/graywh/utstats
PHP | 58 lines | 49 code | 9 blank | 0 comment | 4 complexity | 4a7d2cd1ac2a6f03a0392f12fda2162e MD5 | raw file
  1. <?php
  2. if (empty($import_adminkey) or isset($_REQUEST['import_adminkey']) or $import_adminkey != $adminkey) die('bla');
  3. $options['requireconfirmation'] = false;
  4. $options['title'] = 'IP Search';
  5. $i = 0;
  6. $options['vars'][$i]['name'] = 'ip_from';
  7. $options['vars'][$i]['type'] = 'text';
  8. $options['vars'][$i]['prompt'] = 'Enter the IP you want to search from:';
  9. $options['vars'][$i]['caption'] = 'IP from:';
  10. $i++;
  11. $options['vars'][$i]['name'] = 'ip_to';
  12. $options['vars'][$i]['type'] = 'text';
  13. $options['vars'][$i]['initialvalue'] = 'ip_from';
  14. $options['vars'][$i]['prompt'] = 'Enter the IP you want to search to:';
  15. $options['vars'][$i]['caption'] = 'IP to:';
  16. $i++;
  17. $results = adminselect($options);
  18. $ip_from = $results['ip_from'];
  19. $ip_to = $results['ip_to'];
  20. echo'<br><table border="0" cellpadding="1" cellspacing="2" width="600">
  21. <tr>
  22. <td class="smheading" align="center" colspan="2">Players using IPs '.$ip_from.' - '.$ip_to.' and their last 5 matches using these IPs</td>
  23. </tr>';
  24. $sql_players = "SELECT pi.name, pi.id AS pid FROM uts_player p, uts_pinfo pi WHERE p.pid = pi.id AND p.ip BETWEEN INET_ATON('$ip_from') AND INET_ATON('$ip_to') GROUP BY pid";
  25. $q_players = mysql_query($sql_players) or die(mysql_error());
  26. $j = 0;
  27. while ($r_players = mysql_fetch_array($q_players)) {
  28. echo '<tr>';
  29. echo '<td class="dark" align="center" valign="top" width="150">';
  30. echo '<a class="darkhuman" href="admin.php?action=pinfo&amp;pid='.$r_players['pid'].'">'.$r_players['name'].'</a></td>';
  31. $sql_recent = "SELECT m.time AS time, m.id AS mid, INET_NTOA(p.ip) AS ip FROM uts_player p, uts_match m WHERE m.id = p.matchid AND p.pid = '${r_players['pid']}' AND p.ip BETWEEN INET_ATON('$ip_from') AND INET_ATON('$ip_to') ORDER BY m.time DESC LIMIT 0,5";
  32. echo '<td class="grey">';
  33. echo '<table width="100%" border="0" cellspacing="0" cellpadding="2">';
  34. $q_recent= mysql_query($sql_recent) or die(mysql_error());
  35. while ($r_recent = mysql_fetch_array($q_recent)) {
  36. $j++;
  37. $class = ($j%2) ? 'grey' : 'grey2';
  38. echo '<tr><td class="'.$class.'" align="center" width="60%">';
  39. echo '<a class="'.$class.'" href="./?p=match&amp;mid='.$r_recent['mid'].'">'.mdate($r_recent['time']).'</a>';
  40. echo '</td><td class="'.$class.'" align="center">';
  41. echo $r_recent['ip'];
  42. echo '</td></tr>';
  43. }
  44. echo '</table></td></tr>';
  45. }
  46. echo'<tr>
  47. <td class="smheading" align="center" colspan="2"><a class="grey" href="./admin.php?key='.$_REQUEST[key].'">Go Back To Admin Page</a></td>
  48. </tr></table>';
  49. ?>