prepare( 'SELECT null FROM admin WHERE username=? AND active = 1;' ); $stmt->execute( [ $_SESSION[ 'email_admin_user' ] ] ); if ( ! $stmt->fetch( PDO::FETCH_ASSOC ) ) { $_SESSION = []; session_regenerate_id( true ); $_SESSION[ 'csrf_token' ] = sha1( uniqid() ); $msg .= ''; } } if ( $_SERVER[ 'REQUEST_METHOD' ] === 'POST' ) { if ( isset( $_POST[ 'action' ] ) ) { if ( $_SESSION[ 'csrf_token' ] !== $_POST[ 'csrf_token' ] ?? '' ) { die( 'Invalid csfr token' ); } if ( $_POST[ 'action' ] === 'logout' ) { $_SESSION = []; session_regenerate_id( true ); $_SESSION[ 'csrf_token' ] = sha1( uniqid() ); $msg .= ''; } elseif ( $_POST[ 'action' ] === 'login' ) { if ( empty( $_POST[ 'user' ] ) ) { $ok = false; $msg .= ''; } $stmt = $db->prepare( 'SELECT username, password, password_hash_type, superadmin FROM admin WHERE username = ? AND active = 1;' ); $stmt->execute( [ $_POST[ 'user' ] ] ); if ( $tmp = $stmt->fetch( PDO::FETCH_ASSOC ) ) { if ( empty( $_POST[ 'pwd' ] ) || ! password_verify( $_POST[ 'pwd' ], $tmp[ 'password' ] ) ) { $msg .= ''; } else { $_SESSION[ 'email_admin_user' ] = $tmp[ 'username' ]; $_SESSION[ 'email_admin_superadmin' ] = (bool) $tmp[ 'superadmin' ]; // update password hash if it's using an old hashing algorithm if ( $tmp[ 'password_hash_type' ] !== '{ARGON2ID}' ) { $hash = password_hash( $_POST[ 'pwd' ], PASSWORD_ARGON2ID ); $stmt = $db->prepare( 'UPDATE admin SET password_hash_type = "{ARGON2ID}", password = ? WHERE username = ? AND active = 1;' ); $stmt->execute( [ $hash, $_SESSION[ 'email_admin_user' ] ] ); } } } else { $msg .= ''; } } elseif ( ! empty( $_SESSION[ 'email_admin_user' ] ) ) { if ( $_POST[ 'action' ] === 'update_alias' ) { $alias_goto = ''; if ( isset( $_POST[ 'alias_keep_copy' ] ) ) { $alias_goto .= $_SESSION[ 'email_admin_user' ] . ','; } if ( ! empty( $_POST[ 'alias_to' ] ) ) { $additional = preg_split( "/[\s,]+/", $_POST[ 'alias_to' ] ); $alias_goto .= validate_email_list( $additional, $msg ); } $alias_goto = rtrim( $alias_goto, ',' ); $stmt = $db->prepare( 'UPDATE alias SET goto = ? WHERE address = ? AND active = 1;' ); $stmt->execute( [ $alias_goto, $_SESSION[ 'email_admin_user' ] ] ); } elseif ( $_POST[ 'action' ] === 'delete_admin' && ! empty( $_POST[ 'admin' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { $msg .= ''; $msg .= '
'; $msg .= ''; $msg .= '
'; } elseif ( $_POST[ 'action' ] === 'delete_domain' && ! empty( $_POST[ 'domain' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { $msg .= ''; $msg .= '
'; $msg .= ''; $msg .= '
'; } elseif ( $_POST[ 'action' ] === 'delete_alias_domain' && ! empty( $_POST[ 'alias_domain' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { $msg .= ''; $msg .= '
'; $msg .= ''; $msg .= '
'; } elseif ( $_POST[ 'action' ] === 'delete_alias' && ! empty( $_POST[ 'alias' ] ) ) { $msg .= ''; $msg .= '
'; $msg .= ''; $msg .= '
'; } elseif ( $_POST[ 'action' ] === 'delete_mailbox' && ! empty( $_POST[ 'user' ] ) ) { $msg .= ''; $msg .= '
'; $msg .= ''; $msg .= '
'; } elseif ( $_POST[ 'action' ] === 'delete_admin2' && ! empty( $_POST[ 'admin' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { if ( $_SESSION[ 'email_admin_user' ] === $_POST[ 'admin' ] ) { $msg .= ''; } else { $stmt = $db->prepare( 'DELETE FROM admin WHERE username = ?;' ); $stmt->execute( [ $_POST[ 'admin' ] ] ); $msg .= ''; } } elseif ( $_POST[ 'action' ] === 'delete_domain2' && ! empty( $_POST[ 'domain' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { $stmt = $db->prepare( 'UPDATE domain SET active = -1 WHERE domain = ?;' ); $stmt->execute( [ $_POST[ 'domain' ] ] ); $msg .= ''; } elseif ( $_POST[ 'action' ] === 'delete_alias_domain2' && ! empty( $_POST[ 'alias_domain' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { $stmt = $db->prepare( 'DELETE FROM alias_domain WHERE alias_domain = ?;' ); $stmt->execute( [ $_POST[ 'alias_domain' ] ] ); $msg .= ''; } elseif ( $_POST[ 'action' ] === 'delete_alias2' && ! empty( $_POST[ 'alias' ] ) ) { if ( check_domain_access( $_POST[ 'alias' ], $msg ) ) { $stmt = $db->prepare( 'DELETE FROM alias WHERE address = ?;' ); $stmt->execute( [ $_POST[ 'alias' ] ] ); $msg .= ''; } } elseif ( $_POST[ 'action' ] === 'delete_mailbox2' && ! empty( $_POST[ 'user' ] ) ) { if ( check_domain_access( $_POST[ 'user' ], $msg ) ) { $stmt = $db->prepare( 'UPDATE mailbox SET active = -2 WHERE username = ?;' ); $stmt->execute( [ $_POST[ 'user' ] ] ); $msg .= ''; } } elseif ( $_POST[ 'action' ] === 'save_edit_admin' && ! empty( $_POST[ 'admin' ] ) && ( $_SESSION[ 'email_admin_superadmin' ] || $_POST[ 'admin' ] === $_SESSION[ 'email_admin_user' ] ) ) { $stmt = $db->prepare( 'SELECT null FROM admin WHERE username = ?;' ); $stmt->execute( [ $_POST[ 'admin' ] ] ); if ( ! $stmt->fetch() ) { $msg .= ''; } else { if ( ! empty( $_POST[ 'pass_update' ] ) ) { if ( empty( $_POST[ 'pass_update2' ] ) || $_POST[ 'pass_update' ] !== $_POST[ 'pass_update2' ] ) { $msg .= ''; } else { $hash = password_hash( $_POST[ 'pass_update' ], PASSWORD_ARGON2ID ); $stmt = $db->prepare( 'UPDATE admin SET password_hash_type = "{ARGON2ID}", password = ?, modified = NOW() WHERE username = ?;' ); $stmt->execute( [ $hash, $_POST[ 'admin' ] ] ); $msg .= ''; } } if ( $_SESSION[ 'email_admin_superadmin' ] ) { if ( $_POST[ 'admin' ] !== $_SESSION[ 'email_admin_user' ] ) { $active = isset( $_POST[ 'active' ] ) ? 1 : 0; $superadmin = isset( $_POST[ 'superadmin' ] ) ? 1 : 0; $stmt = $db->prepare( 'UPDATE admin SET superadmin = ?, active = ?, modified = NOW() WHERE username = ?;' ); $stmt->execute( [ $superadmin, $active, $_POST[ 'admin' ] ] ); } $managed_domains = []; $stmt = $db->prepare( 'SELECT domain FROM domain_admins WHERE username = ?;' ); $stmt->execute( [ $_POST[ 'admin' ] ] ); while ( $tmp = $stmt->fetch( PDO::FETCH_ASSOC ) ) { $managed_domains [] = $tmp[ 'domain' ]; } foreach ( $managed_domains as $domain ) { if ( ! in_array( $domain, $_POST[ 'domains' ], true ) ) { $stmt = $db->prepare( 'DELETE FROM domain_admins WHERE username = ? AND domain = ?;' ); $stmt->execute( [ $_POST[ 'admin' ], $domain ] ); } } foreach ( $_POST[ 'domains' ] as $domain ) { if ( ! in_array( $domain, $managed_domains, true ) ) { $stmt = $db->prepare( 'INSERT INTO domain_admins (username, domain) VALUES (?, ?);' ); $stmt->execute( [ $_POST[ 'admin' ], $domain ] ); } } } $msg .= ''; } } elseif ( $_POST[ 'action' ] === 'save_new_admin' && ! empty( $_POST[ 'admin' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { $stmt = $db->prepare( 'SELECT null FROM admin WHERE username = ?;' ); $stmt->execute( [ $_POST[ 'admin' ] ] ); if ( $stmt->fetch() ) { $msg .= ''; } else { if ( empty( $_POST[ 'pass_update2' ] ) || $_POST[ 'pass_update' ] !== $_POST[ 'pass_update2' ] ) { $msg .= ''; } else { $hash = password_hash( $_POST[ 'pass_update' ], PASSWORD_ARGON2ID ); $active = isset( $_POST[ 'active' ] ) ? 1 : 0; $superadmin = isset( $_POST[ 'superadmin' ] ) ? 1 : 0; $stmt = $db->prepare( 'INSERT INTO admin (password_hash_type, password, superadmin, active, username, created, modified) VALUES ("{ARGON2ID}", ?, ?, ?, ?, NOW(), NOW());' ); $stmt->execute( [ $hash, $superadmin, $active, $_POST[ 'admin' ] ] ); $msg .= ''; } } } elseif ( $_POST[ 'action' ] === 'save_edit_domain' && ! empty( $_POST[ 'domain' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { $stmt = $db->prepare( 'SELECT null FROM domain WHERE domain = ?;' ); $stmt->execute( [ $_POST[ 'domain' ] ] ); if ( ! $stmt->fetch() ) { $msg .= ''; } else { $active = isset( $_POST[ 'active' ] ) ? 1 : 0; $stmt = $db->prepare( 'UPDATE domain set active = ?, modified = NOW() WHERE domain = ?;' ); $stmt->execute( [ $active, $_POST[ 'domain' ] ] ); $msg .= ''; } } elseif ( $_POST[ 'action' ] === 'save_edit_alis_domain' && ! empty( $_POST[ 'alias_domain' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { $stmt = $db->prepare( 'SELECT null FROM alias_domain WHERE alias_domain = ?;' ); $stmt->execute( [ $_POST[ 'alias_domain' ] ] ); if ( ! $stmt->fetch() ) { $msg .= ''; } else { $active = isset( $_POST[ 'active' ] ) ? 1 : 0; $stmt = $db->prepare( 'UPDATE alias_domain set active = ?, modified = NOW() WHERE alias_domain = ?;' ); $stmt->execute( [ $active, $_POST[ 'alias_domain' ] ] ); $msg .= ''; } } elseif ( $_POST[ 'action' ] === 'save_new_domain' && ! empty( $_POST[ 'domain' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { $stmt = $db->prepare( 'SELECT null FROM domain WHERE domain = ?;' ); $stmt->execute( [ $_POST[ 'domain' ] ] ); if ( $stmt->fetch() ) { $msg .= ''; } else { $active = isset( $_POST[ 'active' ] ) ? 1 : 0; $stmt = $db->prepare( 'INSERT INTO domain (active, domain, created, modified) VALUES (?, ?, NOW(), NOW());' ); $stmt->execute( [ $active, $_POST[ 'domain' ] ] ); $msg .= ''; } } elseif ( $_POST[ 'action' ] === 'save_new_alias_domain' && ! empty( $_POST[ 'alias_domain' ] ) && $_SESSION[ 'email_admin_superadmin' ] ) { $stmt = $db->prepare( 'SELECT null FROM alias_domain WHERE alias_domain = ?;' ); $stmt->execute( [ $_POST[ 'alias_domain' ] ] ); if ( $stmt->fetch() ) { $msg .= ''; } else { $active = isset( $_POST[ 'active' ] ) ? 1 : 0; $stmt = $db->prepare( 'INSERT INTO alias_domain (active, alias_domain, target_domain, created, modified) VALUES (?, ?, ?, NOW(), NOW());' ); $stmt->execute( [ $active, $_POST[ 'alias_domain' ], $_POST[ 'target_domain' ] ] ); $msg .= ''; } } elseif ( $_POST[ 'action' ] === 'save_new_alias' && ! empty( $_POST[ 'alias' ] ) && ! empty( $_POST[ 'target' ] ) ) { $ok = check_email_valid( $_POST[ 'alias' ], $msg ); if ( $ok ) { $ok = check_domain_access( $_POST[ 'alias' ], $msg ); } if ( $ok ) { $targets = preg_split( "/[\s,]+/", $_POST[ 'target' ] ); $alias_goto = validate_email_list( $targets, $msg ); $stmt = $db->prepare( 'SELECT null FROM alias WHERE address = ?;' ); $stmt->execute( [ $_POST[ 'alias' ] ] ); if ( $stmt->fetch() ) { $msg .= ''; } else { $parser = new EmailParser( new EmailLexer() ); $parser->parse( $_POST[ 'alias' ] ); $domain = $parser->getDomainPart(); $active = isset( $_POST[ 'active' ] ) ? 1 : 0; $enforce_tls_in = isset( $_POST[ 'enforce_tls_in' ] ) ? 1 : 0; $stmt = $db->prepare( 'INSERT INTO alias (goto, address, domain, active, created, modified, enforce_tls_in) VALUES (?, ?, ?, ?, NOW(), NOW(), ?);' ); $stmt->execute( [ $alias_goto, $_POST[ 'alias' ], $domain, $active, $enforce_tls_in ] ); $msg .= ''; } } } elseif ( $_POST[ 'action' ] === 'save_edit_alias' && ! empty( $_POST[ 'alias' ] ) && ! empty( $_POST[ 'target' ] ) ) { $ok = check_email_valid( $_POST[ 'alias' ], $msg ); if ( $ok ) { $ok = check_domain_access( $_POST[ 'alias' ], $msg ); } if ( $ok ) { $targets = preg_split( "/[\s,]+/", $_POST[ 'target' ] ); $alias_goto = validate_email_list( $targets, $msg ); $active = isset( $_POST[ 'active' ] ) ? 1 : 0; $enforce_tls_in = isset( $_POST[ 'enforce_tls_in' ] ) ? 1 : 0; $stmt = $db->prepare( 'UPDATE alias SET goto = ?, active = ?, enforce_tls_in = ?, modified = NOW() WHERE address = ?;' ); $stmt->execute( [ $alias_goto, $active, $enforce_tls_in, $_POST[ 'alias' ] ] ); $msg .= ''; } } elseif ( $_POST[ 'action' ] === 'save_edit_mailbox' && ! empty( $_POST[ 'user' ] ) ) { $ok = check_email_valid( $_POST[ 'user' ], $msg ); if ( $ok ) { $ok = check_domain_access( $_POST[ 'user' ], $msg ); } if ( $ok ) { $alias_goto = ''; if ( isset( $_POST[ 'alias_keep_copy' ] ) ) { $alias_goto .= $_POST[ 'user' ] . ','; } if ( ! empty( $_POST[ 'alias_to' ] ) ) { $additional = preg_split( "/[\s,]+/", $_POST[ 'alias_to' ] ); $alias_goto .= validate_email_list( $additional, $msg ); } $quota = 1024 * 1024 * 1024; $alias_goto = rtrim( $alias_goto, ',' ); $stmt = $db->prepare( 'UPDATE alias SET goto = ?, enforce_tls_in = ?, active = ? WHERE address = ?;' ); $stmt->execute( [ $alias_goto, ( isset( $_POST[ 'enforce_tls_in' ] ) ? 1 : 0 ), ( isset( $_POST[ 'active' ] ) ? 1 : 0 ), $_POST[ 'user' ] ] ); $stmt = $db->prepare( 'UPDATE mailbox SET enforce_tls_in = ?, enforce_tls_out = ?, active = ?, quota = ?, modified = NOW() WHERE username = ?;' ); $stmt->execute( [ ( isset( $_POST[ 'enforce_tls_in' ] ) ? 1 : 0 ), ( isset( $_POST[ 'enforce_tls_out' ] ) ? 1 : 0 ), ( isset( $_POST[ 'active' ] ) ? 1 : 0 ), $quota, $_POST[ 'user' ] ] ); $msg .= ''; } } elseif ( $_POST[ 'action' ] === 'save_new_mailbox' && ! empty( $_POST[ 'user' ] ) ) { $email = $_POST[ 'user' ]; $ok = check_email_valid( $email, $msg ); if ( $ok ) { $ok = check_domain_access( $email, $msg ); } if ( $ok ) { $stmt = $db->prepare( 'SELECT null FROM mailbox WHERE username = ? UNION SELECT null FROM alias WHERE address = ?;' ); $stmt->execute( [ $email, $email ] ); if ( $stmt->fetch() ) { $ok = false; $msg .= ''; } if ( $ok ) { $parser = new EmailParser( new EmailLexer() ); $parser->parse( $email ); $user = $parser->getLocalPart(); $domain = $parser->getDomainPart(); $hash = password_hash( $_POST[ 'pwd' ], PASSWORD_ARGON2ID ); $quota = 50 * 1024 * 1024; $alias_goto = ''; if ( isset( $_POST[ 'alias_keep_copy' ] ) ) { $alias_goto .= $email . ','; } if ( ! empty( $_POST[ 'alias_to' ] ) ) { $additional = preg_split( "/[\s,]+/", $_POST[ 'alias_to' ] ); $alias_goto .= validate_email_list( $additional, $msg ); } $alias_goto = rtrim( $alias_goto, ',' ); $stmt = $db->prepare( 'INSERT INTO alias (address, goto, domain, created, modified, enforce_tls_in, active) VALUES (?, ?, ?, NOW(), NOW(), ?, ?);' ); $stmt->execute( [ $email, $alias_goto, $domain, ( isset( $_POST[ 'enforce_tls_in' ] ) ? 1 : 0 ), ( isset( $_POST[ 'active' ] ) ? 1 : 0 ) ] ); $stmt = $db->prepare( 'INSERT INTO mailbox (username, password, quota, local_part, domain, created, modified, password_hash_type, openpgpkey_wkd, enforce_tls_in, enforce_tls_out, active) VALUES(?, ?, ?, ?, ?, NOW(), NOW(), ?, ?, ?, ?, ?);' ); $stmt->execute( [ $email, $hash, $quota, $user, $domain, '{ARGON2ID}', z_base32_encode( hash( 'sha1', mb_strtolower( $user ), true ) ), ( isset( $_POST[ 'enforce_tls_in' ] ) ? 1 : 0 ), ( isset( $_POST[ 'enforce_tls_out' ] ) ? 1 : 0 ), ( isset( $_POST[ 'active' ] ) ? 1 : 0 ) ] ); $msg .= ''; } } } elseif ( $_POST[ 'action' ] === 'save_password_mailbox' && ! empty( $_POST[ 'user' ] ) ) { $ok = check_email_valid( $_POST[ 'user' ], $msg ); if ( $ok ) { $ok = check_domain_access( $_POST[ 'user' ], $msg ); } if ( $ok ) { if ( empty( $_POST[ 'pass_update' ] ) || empty( $_POST[ 'pass_update2' ] ) || $_POST[ 'pass_update' ] !== $_POST[ 'pass_update2' ] ) { $msg .= ''; } else { $hash = password_hash( $_POST[ 'pass_update' ], PASSWORD_ARGON2ID ); $stmt = $db->prepare( 'UPDATE mailbox SET password_hash_type = "{ARGON2ID}", password = ? WHERE username = ?;' ); $stmt->execute( [ $hash, $_POST[ 'user' ] ] ); $msg .= ''; } } } elseif ( $_POST[ 'action' ] === 'disable_tfa_mailbox' && ! empty( $_POST[ 'user' ] ) ) { $ok = check_email_valid( $_POST[ 'user' ], $msg ); if ( $ok ) { $ok = check_domain_access( $_POST[ 'user' ], $msg ); } if ( $ok ) { $stmt = $db->prepare( 'UPDATE mailbox SET tfa = 0 WHERE username = ?;' ); $stmt->execute( [ $_POST[ 'user' ] ] ); $msg .= ''; } } } } } ?> Daniel - E-Mail and XMPP - Admin management

Logged in as | | Manage admins | Manage alias domains | Manage your admin account | Manage domains | Manage aliases | Manage mailboxes

$msg

"; if ( empty( $_SESSION[ 'email_admin_user' ] ) ) { ?>

Welcome to the admin management interface. You can configure your domain(s) and accounts here. Please select an option from the menu.

Oops, it looks like the page you tried to access does not exist or you do not have permission to access it.

query( 'SELECT username, modified, active FROM admin;' ); ?>

Create new admin

Admin
Active
Last modified
Edit account
fetch( PDO::FETCH_ASSOC ) ) { $active = 'Disabled'; if ( $tmp[ 'active' ] === 1 ) { $active = 'Active'; } echo '
' . htmlspecialchars( $tmp[ 'username' ] ) . '
' . $active . '
' . $tmp[ 'modified' ] . '
'; } ?>

Create new admin

prepare( 'SELECT username, superadmin, active FROM admin WHERE username = ?;' ); $stmt->execute( [ $admin ] ); if ( $admin = $stmt->fetch( PDO::FETCH_ASSOC ) ) { ?>

Edit admin account

Superadmins can manage other admins
Superadmins can manage other admins
Oops, this admin doesn\'t seem to exist.

'; } } function send_new_admin(): void { ?>

Create new admin account

Superadmins can manage other admins
query( 'SELECT domain, modified, active FROM domain;' ); if ( $_SESSION[ 'email_admin_superadmin' ] ) { ?>

Create new domain

Domain
Active
Last modified
Edit domain
fetch( PDO::FETCH_ASSOC ) ) { $active = 'Disabled'; if ( $tmp[ 'active' ] === 1 ) { $active = 'Active'; } elseif ( $tmp[ 'active' ] === -1 ) { $active = 'Deleting'; } echo '
' . htmlspecialchars( $tmp[ 'domain' ] ) . '
' . $active . '
' . $tmp[ 'modified' ] . '
'; } ?>

Create new domain

Create new domain

prepare( 'SELECT domain, active FROM domain WHERE domain = ?;' ); $stmt->execute( [ $_POST[ 'domain' ] ] ); if ( $admin = $stmt->fetch( PDO::FETCH_ASSOC ) ) { ?>

Edit domain

Oops, this admin doesn\'t seem to exist.

'; } } function send_manage_alias_domains(): void { $db = get_db_instance(); $stmt = $db->query( 'SELECT alias_domain, target_domain, modified, active FROM alias_domain;' ); if ( $_SESSION[ 'email_admin_superadmin' ] ) { ?>

Create new alias domain

Alias Domain
Target Domain
Active
Last modified
Edit alias domain
fetch( PDO::FETCH_ASSOC ) ) { $active = 'Disabled'; if ( $tmp[ 'active' ] === 1 ) { $active = 'Active'; } echo '
' . htmlspecialchars( $tmp[ 'alias_domain' ] ) . '
' . htmlspecialchars( $tmp[ 'target_domain' ] ) . '
' . $active . '
' . $tmp[ 'modified' ] . '
'; } ?>

Create new alias domain

Create new alias domain

prepare( 'SELECT alias_domain, target_domain, active FROM alias_domain WHERE alias_domain = ?;' ); $stmt->execute( [ $_POST[ 'alias_domain' ] ] ); if ( $alias = $stmt->fetch( PDO::FETCH_ASSOC ) ) { ?>

Edit alias domain

Oops, this alias domain doesn\'t seem to exist.

'; } } function send_manage_aliases(): void { $db = get_db_instance(); $stmt = $db->prepare( 'SELECT a.address, a.goto, a.modified, a.active FROM alias AS a LEFT JOIN mailbox AS m ON (m.username=a.address AND m.active=1) WHERE a.domain IN (SELECT domain FROM domain_admins WHERE username = ?) AND isnull(m.username) limit 200;' ); $stmt->execute( [ $_SESSION[ 'email_admin_user' ] ] ); ?>

Create new alias

Alias
Target
Active
Last modified
Edit alias
fetch( PDO::FETCH_ASSOC ) ) { $active = 'Disabled'; if ( $tmp[ 'active' ] === 1 ) { $active = 'Active'; } echo '
' . htmlspecialchars( $tmp[ 'address' ] ) . '
' . htmlspecialchars( $tmp[ 'goto' ] ) . '
' . $active . '
' . $tmp[ 'modified' ] . '
'; } ?>

Create new alias

Create new alias

prepare( 'SELECT a.address, a.goto, a.active, a.enforce_tls_in FROM alias AS a LEFT JOIN mailbox AS m ON (m.username=a.address AND m.active=1) WHERE a.address = ? AND isnull(m.username);' ); $stmt->execute( [ $_POST[ 'alias' ] ] ); if ( $alias = $stmt->fetch( PDO::FETCH_ASSOC ) ) { ?>

Edit alias

Oops, this alias doesn\'t seem to exist.

'; } } function send_manage_mailboxes(): void { $db = get_db_instance(); $stmt = $db->prepare( 'SELECT username, modified, active FROM mailbox WHERE domain IN (SELECT domain FROM domain_admins WHERE username = ?) limit 200;' ); $stmt->execute( [ $_SESSION[ 'email_admin_user' ] ] ); ?>

Create new mailbox

Username
Active
Last modified
Edit mailbox
fetch( PDO::FETCH_ASSOC ) ) { $active = 'Disabled'; if ( $tmp[ 'active' ] === 1 ) { $active = 'Active'; } elseif ( $tmp[ 'active' ] === -1 ) { $active = 'Disabling'; } elseif ( $tmp[ 'active' ] === -2 ) { $active = 'Deleting'; } echo '
' . htmlspecialchars( $tmp[ 'username' ] ) . '
' . $active . '
' . $tmp[ 'modified' ] . '
'; } ?>

Create new mailbox

Create new mailbox

prepare( 'SELECT a.goto, m.active, m.enforce_tls_in, m.enforce_tls_out FROM alias AS a INNER JOIN mailbox AS m ON (m.username=a.address) WHERE m.username = ?;' ); $stmt->execute( [ $_REQUEST[ 'user' ] ] ); if ( $email = $stmt->fetch( PDO::FETCH_ASSOC ) ) { $aliases = explode( ',', $email[ 'goto' ] ); $aliases_to = implode( "\n", array_diff( $aliases, [ $_POST[ 'user' ] ] ) ); ?>

Edit mailbox

>

Change password

Delete mailbox / Disable two factor authentication

Oops, this mailbox doesn\'t seem to exist.

'; } }