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.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?
  2. if (!check_perms('admin_login_watch')) {
  3. error(403);
  4. }
  5. if (isset($_POST['submit']) && isset($_POST['id']) && $_POST['submit'] == 'Unban' && is_number($_POST['id'])) {
  6. authorize();
  7. $DB->query('
  8. DELETE FROM login_attempts
  9. WHERE ID = '.$_POST['id']);
  10. }
  11. View::show_header('Login Watch');
  12. $DB->query('
  13. SELECT
  14. ID,
  15. IP,
  16. UserID,
  17. LastAttempt,
  18. Attempts,
  19. BannedUntil,
  20. Bans
  21. FROM login_attempts
  22. WHERE BannedUntil > "'.sqltime().'"
  23. ORDER BY BannedUntil ASC');
  24. ?>
  25. <div class="thin">
  26. <div class="header">
  27. <h2>Login Watch Management</h2>
  28. </div>
  29. <table width="100%">
  30. <tr class="colhead">
  31. <td>IP</td>
  32. <td>User</td>
  33. <td>Bans</td>
  34. <td>Remaining</td>
  35. <td>Submit</td>
  36. <? if (check_perms('admin_manage_ipbans')) { ?>
  37. <td>Submit</td>
  38. <? } ?>
  39. </tr>
  40. <?
  41. while (list($ID, $IP, $UserID, $LastAttempt, $Attempts, $BannedUntil, $Bans) = $DB->next_record()) {
  42. ?>
  43. <tr class="row">
  44. <td>
  45. <?=$IP?>
  46. </td>
  47. <td>
  48. <? if ($UserID != 0) { echo Users::format_username($UserID, true, true, true, true); } ?>
  49. </td>
  50. <td>
  51. <?=$Bans?>
  52. </td>
  53. <td>
  54. <?=time_diff($BannedUntil)?>
  55. </td>
  56. <td>
  57. <form class="manage_form" name="bans" action="" method="post">
  58. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  59. <input type="hidden" name="id" value="<?=$ID?>" />
  60. <input type="hidden" name="action" value="login_watch" />
  61. <input type="submit" name="submit" value="Unban" />
  62. </form>
  63. </td>
  64. <? if (check_perms('admin_manage_ipbans')) { ?>
  65. <td>
  66. <form class="manage_form" name="bans" action="" method="post">
  67. <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
  68. <input type="hidden" name="id" value="<?=$ID?>" />
  69. <input type="hidden" name="action" value="ip_ban" />
  70. <input type="hidden" name="start" value="<?=$IP?>" />
  71. <input type="hidden" name="end" value="<?=$IP?>" />
  72. <input type="hidden" name="notes" value="Banned per <?=$Bans?> bans on login watch." />
  73. <input type="submit" name="submit" value="IP Ban" />
  74. </form>
  75. </td>
  76. <? } ?>
  77. </tr>
  78. <?
  79. }
  80. ?>
  81. </table>
  82. </div>
  83. <? View::show_footer(); ?>