del_user.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /*
  3. *
  4. * OGP - Open Game Panel
  5. * Copyright (C) 2008 - 2017 The OGP Development Team
  6. *
  7. * http://www.opengamepanel.org/
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. function exec_ogp_module()
  25. {
  26. global $db;
  27. global $view;
  28. $user_id = $_GET['user_id'];
  29. $y = isset($_GET['y']) ? $_GET['y'] : "";
  30. $user = $db->getUserById($user_id);
  31. if ( empty($user) )
  32. {
  33. print_failure(get_lang_f('user_with_id_does_not_exist', $user_id));
  34. return;
  35. }
  36. $username = $user['users_login'];
  37. if($y !== 'y')
  38. {
  39. if(!$db->isModuleInstalled("subusers")){
  40. echo "<p>".get_lang_f('are_you_sure_you_want_to_delete_user', $username)."</p>";
  41. }else{
  42. if(!$db->isSubUser($user_id)){
  43. echo "<p>".get_lang_f('are_you_sure_you_want_to_delete_user', $username) . get_lang('andSubUsers') . "</p>";
  44. }else{
  45. echo "<p>".get_lang_f('are_you_sure_you_want_to_delete_user', $username)."</p>";
  46. }
  47. }
  48. echo "<p><a href=\"?m=user_admin&amp;p=del&amp;user_id=$user_id&amp;y=y\">".
  49. get_lang('yes')."</a> <a href=\"?m=user_admin\">".
  50. get_lang('no')."</a></p>";
  51. return;
  52. }
  53. if( !$db->delUser($user_id) )
  54. {
  55. print_failure(get_lang_f('unable_to_delete_user', $username));
  56. $view->refresh("?m=user_admin");
  57. return;
  58. }
  59. print_success(get_lang_f('successfully_deleted_user', $username));
  60. $db->logger(get_lang_f('successfully_deleted_user', $username));
  61. $view->refresh("?m=user_admin");
  62. };
  63. ?>