banlist.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <script type="text/javascript" src="js/modules/administration.js"></script>
  2. <?php
  3. /*
  4. *
  5. * OGP - Open Game Panel
  6. * Copyright (C) Copyright (C) 2008 - 2013 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. $db->query("UPDATE `OGP_DB_PREFIXban_list` SET logging_attempts='0', banned_until='0' WHERE client_ip = '$ip';");
  35. }
  36. }
  37. $ban_list = $db->resultQuery("SELECT logging_attempts, banned_until, client_ip FROM `OGP_DB_PREFIXban_list`;");
  38. $ban_qty = 0;
  39. $ban_table = '';
  40. foreach($ban_list as $ban)
  41. {
  42. if($ban['logging_attempts'] >= $settings["login_attempts_before_banned"])
  43. {
  44. $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";
  45. $ban_qty++;
  46. }
  47. else
  48. {
  49. continue;
  50. }
  51. }
  52. if($ban_qty == 0)
  53. {
  54. print_failure(get_lang('no_banned_ips'));
  55. }
  56. else
  57. {
  58. echo "<form method=post >\n".
  59. "<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".
  60. "<input type=submit name=unban value='".get_lang('unban_selected_ips')."' /></form>";
  61. }
  62. echo create_back_button($_GET['m'],"main");
  63. }
  64. ?>