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.

69 lines
1.8 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: create-admin.php
  16. * Used to create new administrators.
  17. * Template File: admin_create-admin.php
  18. *
  19. *
  20. * Template Variables:
  21. *
  22. * tMessage
  23. * tUsername
  24. * tDomains
  25. *
  26. * Form POST \ GET Variables:
  27. *
  28. * fUsername
  29. * fPassword
  30. * fPassword2
  31. * fDomains
  32. */
  33. require_once('common.php');
  34. authentication_require_role('global-admin');
  35. $list_domains = list_domains ();
  36. $tDomains = array();
  37. if ($_SERVER['REQUEST_METHOD'] == "GET")
  38. {
  39. $pAdminCreate_admin_username_text = $PALANG['pAdminCreate_admin_username_text'];
  40. $tDomains = array ();
  41. }
  42. if ($_SERVER['REQUEST_METHOD'] == "POST")
  43. {
  44. if (isset ($_POST['fUsername'])) $fUsername = escape_string ($_POST['fUsername']);
  45. if (isset ($_POST['fPassword'])) $fPassword = escape_string ($_POST['fPassword']);
  46. if (isset ($_POST['fPassword2'])) $fPassword2 = escape_string ($_POST['fPassword2']);
  47. $fDomains = array();
  48. if (!empty ($_POST['fDomains'])) $fDomains = $_POST['fDomains'];
  49. list ($error, $tMessage, $pAdminCreate_admin_username_text, $pAdminCreate_admin_password_text) = create_admin($fUsername, $fPassword, $fPassword2, $fDomains);
  50. if ($error != 0) {
  51. if (isset ($_POST['fUsername'])) $tUsername = escape_string ($_POST['fUsername']);
  52. if (isset ($_POST['fDomains'])) $tDomains = $_POST['fDomains'];
  53. }
  54. }
  55. include ("templates/header.php");
  56. include ("templates/menu.php");
  57. include ("templates/admin_create-admin.php");
  58. include ("templates/footer.php");
  59. /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
  60. ?>