PostfixAdmin - web based virtual user administration interface for Postfix mail servers https://postfixadmin.github.io/postfixadmin/
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.

99 lines
2.6 KiB

  1. <?php
  2. //
  3. // Postfix Admin
  4. // by Mischa Peters <mischa at high5 dot net>
  5. // Copyright (c) 2002 - 2005 High5!
  6. // Licensed under GPL for more info check GPL-LICENSE.TXT
  7. //
  8. // File: edit-active.php
  9. //
  10. // Template File: message.tpl
  11. //
  12. // Template Variables:
  13. //
  14. // tMessage
  15. //
  16. // Form POST \ GET Variables:
  17. //
  18. // fUsername
  19. // fDomain
  20. // fReturn
  21. //
  22. require ("./variables.inc.php");
  23. require ("./config.inc.php");
  24. require ("./functions.inc.php");
  25. include ("./languages/" . check_language () . ".lang");
  26. $SESSID_USERNAME = check_session();
  27. if ($_SERVER['REQUEST_METHOD'] == "GET")
  28. {
  29. if (isset ($_GET['username'])) $fUsername = escape_string ($_GET['username']);
  30. if (isset ($_GET['alias'])) $fAlias = escape_string ($_GET['alias']); else $fAlias = escape_string ($_GET['username']);
  31. if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']);
  32. if (isset ($_GET['return'])) $fReturn = escape_string ($_GET['return']);
  33. if (!check_owner ($SESSID_USERNAME, $fDomain))
  34. {
  35. $error = 1;
  36. $tMessage = $PALANG['pEdit_mailbox_domain_error'] . "<b>$fDomain</b>!</font>";
  37. }
  38. else
  39. {
  40. $setSql=('pgsql'==$CONF['database_type']) ? 'active=NOT active' : 'active=1-active';
  41. if ($fUsername != '')
  42. {
  43. $result = db_query ("UPDATE $table_mailbox SET $setSql WHERE username='$fUsername' AND domain='$fDomain'");
  44. if ($result['rows'] != 1)
  45. {
  46. $error = 1;
  47. $tMessage = $PALANG['pEdit_mailbox_result_error'];
  48. }
  49. else
  50. {
  51. db_log ($SESSID_USERNAME, $fDomain, "edit active", $fUsername);
  52. }
  53. }
  54. if ($fAlias != '')
  55. {
  56. $result = db_query ("UPDATE $table_alias SET $setSql WHERE address='$fAlias' AND domain='$fDomain'");
  57. if ($result['rows'] != 1)
  58. {
  59. $error = 1;
  60. $tMessage = $PALANG['pEdit_mailbox_result_error'];
  61. }
  62. else
  63. {
  64. db_log ($SESSID_USERNAME, $fDomain, "edit alias active", $fAlias);
  65. }
  66. }
  67. }
  68. if ($error != 1)
  69. {
  70. if ( $fReturn != "" )
  71. {
  72. header ("Location: $fReturn");
  73. }
  74. else
  75. {
  76. header ("Location: overview.php?domain=$fDomain");
  77. }
  78. exit;
  79. }
  80. include ("./templates/header.tpl");
  81. include ("./templates/menu.tpl");
  82. include ("./templates/message.tpl");
  83. include ("./templates/footer.tpl");
  84. }
  85. if ($_SERVER['REQUEST_METHOD'] == "POST")
  86. {
  87. include ("./templates/header.tpl");
  88. include ("./templates/menu.tpl");
  89. include ("./templates/message.tpl");
  90. include ("./templates/footer.tpl");
  91. }
  92. /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
  93. ?>