index.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. // Init
  3. error_reporting(NULL);
  4. ob_start();
  5. session_start();
  6. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  7. // Check token
  8. if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
  9. header('location: /login/');
  10. exit();
  11. }
  12. // Check user
  13. if ($_SESSION['user'] != 'admin') {
  14. header("Location: /list/user");
  15. exit;
  16. }
  17. if (!empty($_GET['user'])) {
  18. $user=$_GET['user'];
  19. }
  20. // DNS domain
  21. if ((!empty($_GET['domain'])) && (empty($_GET['record_id']))) {
  22. $v_username = escapeshellarg($user);
  23. $v_domain = escapeshellarg($_GET['domain']);
  24. exec (VESTA_CMD."v-unsuspend-dns-domain ".$v_username." ".$v_domain, $output, $return_var);
  25. if ($return_var != 0) {
  26. $error = implode('<br>', $output);
  27. if (empty($error)) $error = __('Error: vesta did not return any output.');
  28. $_SESSION['error_msg'] = $error;
  29. }
  30. unset($output);
  31. $back=getenv("HTTP_REFERER");
  32. if (!empty($back)) {
  33. header("Location: ".$back);
  34. exit;
  35. }
  36. header("Location: /list/dns/");
  37. exit;
  38. }
  39. // DNS record
  40. if ((!empty($_GET['domain'])) && (!empty($_GET['record_id']))) {
  41. $v_username = escapeshellarg($user);
  42. $v_domain = escapeshellarg($_GET['domain']);
  43. $v_record_id = escapeshellarg($_GET['record_id']);
  44. exec (VESTA_CMD."v-unsuspend-dns-record ".$v_username." ".$v_domain." ".$v_record_id, $output, $return_var);
  45. if ($return_var != 0) {
  46. $error = implode('<br>', $output);
  47. if (empty($error)) $error = __('Error: vesta did not return any output.');
  48. $_SESSION['error_msg'] = $error;
  49. }
  50. unset($output);
  51. $back=getenv("HTTP_REFERER");
  52. if (!empty($back)) {
  53. header("Location: ".$back);
  54. exit;
  55. }
  56. header("Location: /list/dns/?domain=".$_GET['domain']);
  57. exit;
  58. }
  59. $back=getenv("HTTP_REFERER");
  60. if (!empty($back)) {
  61. header("Location: ".$back);
  62. exit;
  63. }
  64. header("Location: /list/dns/");
  65. exit;