Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ip_history_userview.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?
  2. $UserID = $_GET['userid'];
  3. if (!is_number($UserID)) {
  4. error(404);
  5. }
  6. $Self = ($UserID == $LoggedUser['ID']);
  7. if (!check_perms('users_mod') && !$Self) {
  8. error(403);
  9. }
  10. if (!apcu_exists('DBKEY')) {
  11. error('The site is currently running with partial database access. Please wait for staff to fully decrypt it');
  12. }
  13. $DB->query("
  14. SELECT IP
  15. FROM users_history_ips
  16. WHERE UserID = '$UserID'");
  17. $EncIPs = $DB->collect("IP");
  18. $IPs = [];
  19. foreach ($EncIPs as $Enc) {
  20. if (!isset($IPs[Crypto::decrypt($Enc)])) {
  21. $IPs[Crypto::decrypt($Enc)] = [];
  22. }
  23. $IPs[Crypto::decrypt($Enc)][] = $Enc;
  24. }
  25. $DB->query("
  26. SELECT IP
  27. FROM users_main
  28. WHERE ID = '$UserID'");
  29. list($Curr) = $DB->next_record();
  30. $Curr = Crypto::decrypt($Curr);
  31. if (!$Self) {
  32. $DB->query("SELECT Username FROM users_main WHERE ID = '$UserID'");
  33. list($Username) = $DB->next_record();
  34. View::show_header("IP history for $Username");
  35. } else {
  36. View::show_header("Your IP history");
  37. }
  38. ?>
  39. <div class="header">
  40. <? if ($Self) { ?>
  41. <h2>Your IP history</h2>
  42. <? } else { ?>
  43. <h2>IP history for <a href="user.php?id=<?=$UserID?>"><?=$Username?></a></h2>
  44. <? } ?>
  45. </div>
  46. <table width="100%">
  47. <tr class="colhead">
  48. <td>IP</td>
  49. <td>Expunge</td>
  50. </tr>
  51. <? foreach ($IPs as $IP => $Encs) { ?>
  52. <tr class="row">
  53. <td><?=display_str($IP)?></td>
  54. <td>
  55. <? if ($IP != $Curr) { ?>
  56. <a href="delete.php?action=ip&ips[]=<?=implode('&ips[]=', array_map('urlencode', $Encs))?>" class="brackets">X</a>
  57. <? } ?>
  58. </td>
  59. </tr>
  60. <? } ?>
  61. </table>
  62. <? View::show_footer(); ?>