banlist.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <script type="text/javascript" src="js/modules/administration.js"></script>
  2. <?php
  3. /*
  4. *
  5. * OGP - Open Game Panel
  6. * Copyright (C) 2008 - 2018 The OGP Development Team
  7. *
  8. * http://www.opengamepanel.org/
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version 2
  13. * of the License, or any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. *
  24. */
  25. function exec_ogp_module()
  26. {
  27. echo "<h2>".get_lang('ban_list')."</h2>";
  28. global $db, $settings;
  29. if(isset($_POST['unban']))
  30. {
  31. unset($_POST['unban']);
  32. foreach($_POST as $name => $ip)
  33. {
  34. $ip = $db->real_escape_string($ip);
  35. $db->query("DELETE FROM `OGP_DB_PREFIXban_list` WHERE client_ip = '$ip';");
  36. }
  37. }
  38. $ban_list = $db->resultQuery("SELECT logging_attempts, banned_until, client_ip FROM `OGP_DB_PREFIXban_list`;");
  39. $ban_qty = 0;
  40. $ban_table = '';
  41. if($ban_list)
  42. {
  43. foreach($ban_list as $ban)
  44. {
  45. if($ban['logging_attempts'] >= $settings["login_attempts_before_banned"])
  46. {
  47. $ban_table .= "<tr><td><input type=checkbox name='".$ban_qty."' value='".$ban['client_ip']."' /></td><td>".$ban['client_ip']."</td><td>".date("r",$ban['banned_until'])."</td></tr>\n";
  48. $ban_qty++;
  49. }
  50. else
  51. {
  52. continue;
  53. }
  54. }
  55. }
  56. if($ban_qty == 0)
  57. {
  58. print_failure(get_lang('no_banned_ips'));
  59. }
  60. else
  61. {
  62. echo "<form method=post >\n".
  63. "<table><tr><th><span id=check >".get_lang('unban')."</span></th><th>".get_lang('client_ip')."</th><th>".get_lang('banned_until')."</th></tr>\n".$ban_table."</table>\n".
  64. "<input type=submit name=unban value='".get_lang('unban_selected_ips')."' /></form>";
  65. }
  66. echo create_back_button($_GET['m'],"main");
  67. }
  68. ?>