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.

delete_supermaster.php 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /* Poweradmin, a friendly web-based admin tool for PowerDNS.
  3. * See <http://www.poweradmin.org> for more details.
  4. *
  5. * Copyright 2007-2010 Rejo Zenger <rejo@zenger.nl>
  6. * Copyright 2010-2017 Poweradmin Development Team
  7. * <http://www.poweradmin.org/credits.html>
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) 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, see <http://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * Script that handles deletion of supermasters
  24. *
  25. * @package Poweradmin
  26. * @copyright 2007-2010 Rejo Zenger <rejo@zenger.nl>
  27. * @copyright 2010-2017 Poweradmin Development Team
  28. * @license http://opensource.org/licenses/GPL-3.0 GPL
  29. */
  30. require_once("inc/toolkit.inc.php");
  31. include_once("inc/header.inc.php");
  32. $master_ip = "-1";
  33. if (isset($_GET['master_ip']) && (is_valid_ipv4($_GET['master_ip']) || is_valid_ipv6($_GET['master_ip']))) {
  34. $master_ip = $_GET['master_ip'];
  35. }
  36. $ns_name = "-1";
  37. if (isset($_GET['ns_name']) && (is_valid_hostname_fqdn($_GET['ns_name'], 0))) {
  38. $ns_name = $_GET['ns_name'];
  39. }
  40. $confirm = "-1";
  41. if ((isset($_GET['confirm'])) && (v_num($_GET['confirm']))) {
  42. $confirm = $_GET['confirm'];
  43. }
  44. if ($master_ip == "-1" || $ns_name == "-1") {
  45. error(ERR_INV_INPUT);
  46. } else {
  47. (do_hook('verify_permission' , 'supermaster_edit' )) ? $perm_sm_edit = "1" : $perm_sm_edit = "0";
  48. if ($perm_sm_edit == "0") {
  49. error(ERR_PERM_DEL_SM);
  50. } else {
  51. $info = get_supermaster_info_from_ip($master_ip);
  52. echo " <h2>" . _('Delete supermaster') . " \"" . $master_ip . "\"</h2>\n";
  53. if (isset($_GET['confirm']) && $_GET["confirm"] == '1') {
  54. if (!supermaster_ip_name_exists($master_ip, $ns_name)) {
  55. header("Location: list_supermasters.php");
  56. exit;
  57. }
  58. if (delete_supermaster($master_ip, $ns_name)) {
  59. success(SUC_SM_DEL);
  60. }
  61. } else {
  62. echo " <p>\n";
  63. echo " " . _('Hostname in NS record') . ": " . $info['ns_name'] . "<br>\n";
  64. echo " " . _('Account') . ": " . $info['account'] . "\n";
  65. echo " </p>\n";
  66. echo " <p>" . _('Are you sure?') . "</p>\n";
  67. echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='delete_supermaster.php?master_ip=" . $master_ip . "&amp;ns_name=" . $info['ns_name'] . "&amp;confirm=1'\" value=\"" . _('Yes') . "\">\n";
  68. echo " <input type=\"button\" class=\"button\" OnClick=\"location.href='index.php'\" value=\"" . _('No') . "\">\n";
  69. }
  70. }
  71. }
  72. include_once("inc/footer.inc.php");