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.

60 lines
1.4 KiB

  1. <?php
  2. /**
  3. * Postfix Admin
  4. *
  5. * LICENSE
  6. * This source file is subject to the GPL license that is bundled with
  7. * this package in the file LICENSE.TXT.
  8. *
  9. * Further details on the project are available at :
  10. * http://www.postfixadmin.com or http://postfixadmin.sf.net
  11. *
  12. * @version $Id$
  13. * @license GNU GPL v2 or later.
  14. *
  15. * File: edit-active-admin.php
  16. * Edit an active administrator. This is used as a 'toggle' page from list-admin.
  17. *
  18. * Template File: message.tpl
  19. *
  20. * Template Variables:
  21. *
  22. * tMessage
  23. *
  24. * Form POST \ GET Variables:
  25. *
  26. * fUsername
  27. */
  28. require_once('common.php');
  29. authentication_require_role('global-admin');
  30. if ($_SERVER['REQUEST_METHOD'] == "GET")
  31. {
  32. if (isset ($_GET['username'])) $fUsername = escape_string ($_GET['username']);
  33. $sqlSet='active=1-active';
  34. if ('pgsql'==$CONF['database_type']) $sqlSet='active=NOT active';
  35. $result = db_query ("UPDATE $table_admin SET $sqlSet,modified=NOW() WHERE username='$fUsername'");
  36. if ($result['rows'] != 1)
  37. {
  38. $error = 1;
  39. $tMessage = $PALANG['pAdminEdit_admin_result_error'];
  40. }
  41. if ($error != 1)
  42. {
  43. header ("Location: list-admin.php");
  44. exit;
  45. }
  46. }
  47. $smarty->assign ('tMessage', $tMessage);
  48. $smarty->assign ('smarty_template', 'message');
  49. $smarty->display ('index.tpl');
  50. /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
  51. ?>