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.

login_watch.php 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?
  2. if (!check_perms('admin_login_watch')) {
  3. error(403);
  4. }
  5. if (isset($_POST['submit']) && isset($_POST['ip']) && $_POST['submit'] == 'Unban') {
  6. authorize();
  7. $Cache->delete_value('login_attempts_'.$_POST['ip']);
  8. }
  9. View::show_header('Login Watch');
  10. $AttemptIPs = $Cache->get_value('login_attempts');
  11. $AllAttempts = array();
  12. foreach($AttemptIPs as $IP => $Time) {
  13. if (time() > $Time) { continue; }
  14. list($Attempts, $Banned) = $Cache->get_value('login_attempts_'.$IP);
  15. if (!isset($Attempts) && !isset($Banned)) { continue; }
  16. $AllAttempts[] = [$IP, $Attempts, $Banned, $Time];
  17. }
  18. ?>
  19. <div class="thin">
  20. <div class="header">
  21. <h2>Login Watch Management</h2>
  22. </div>
  23. <table width="100%">
  24. <tr class="colhead">
  25. <td>IP</td>
  26. <td>Attempts</td>
  27. <td>Banned</td>
  28. <td>Time</td>
  29. <td>Submit</td>
  30. <? if (check_perms('admin_manage_ipbans')) { ?>
  31. <td>Submit</td>
  32. <? } ?>
  33. </tr>
  34. <?
  35. while (list($IP, $Attempts, $Banned, $BannedUntil) = array_shift($AllAttempts)) {
  36. ?>
  37. <tr class="row">
  38. <td>
  39. <?=$IP?>
  40. </td>
  41. <td>
  42. <?=$Attempts?>
  43. </td>
  44. <td>
  45. <?=($Banned?'Yes':'No')?>
  46. </td>
  47. <td>
  48. <?=time_diff($BannedUntil)?>
  49. </td>
  50. <td>
  51. <form class="manage_form" name="bans" action="" method="post">
  52. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  53. <input type="hidden" name="ip" value="<?=$IP?>" />
  54. <input type="hidden" name="action" value="login_watch" />
  55. <input type="submit" name="submit" value="Unban" />
  56. </form>
  57. </td>
  58. <? if (check_perms('admin_manage_ipbans')) { ?>
  59. <td>
  60. <form class="manage_form" name="bans" action="" method="post">
  61. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  62. <input type="hidden" name="action" value="ip_ban" />
  63. <input type="hidden" name="start" value="<?=$IP?>" />
  64. <input type="hidden" name="end" value="<?=$IP?>" />
  65. <input type="hidden" name="notes" value="Banned per <?=$Attempts?> bans on login watch." />
  66. <input type="submit" name="submit" value="IP Ban" />
  67. </form>
  68. </td>
  69. <? } ?>
  70. </tr>
  71. <?
  72. }
  73. ?>
  74. </table>
  75. </div>
  76. <? View::show_footer(); ?>