Example #1
0
require_once $GLOBALS['srcdir'] . "/classes/postmaster.php";
$alertmsg = '';
$bg_msg = '';
$set_active_msg = 0;
$show_message = 0;
/* Sending a mail to the admin when the breakglass user is activated only if $GLOBALS['Emergency_Login_email'] is set to 1 */
$bg_count = count($access_group);
$mail_id = explode(".", $SMTP_HOST);
for ($i = 0; $i < $bg_count; $i++) {
    if ($_GET['access_group'][$i] == "Emergency Login" && $_GET['active'] == 'on' && $_GET['pre_active'] == 0) {
        if ($_GET['get_admin_id'] == 1 && $_GET['admin_id'] != "") {
            $res = sqlStatement("select username from users where id={$_GET["id"]}");
            $row = sqlFetchArray($res);
            $uname = $row['username'];
            $mail = new MyMailer();
            $mail->SetLanguage("en", $GLOBALS['fileroot'] . "/library/");
            $mail->From = "admin@" . $mail_id[1] . "." . $mail_id[2];
            $mail->FromName = "Administrator OpenEMR";
            $text_body = "Hello Security Admin,\n\n The Emergency Login user " . $uname . " was activated at " . date('l jS \\of F Y h:i:s A') . " \n\nThanks,\nAdmin OpenEMR.";
            $mail->Body = $text_body;
            $mail->Subject = "Emergency Login User Activated";
            $mail->AddAddress($_GET['admin_id']);
            $mail->Send();
        }
    }
}
/* To refresh and save variables in mail frame */
if (isset($_POST["privatemode"]) && $_POST["privatemode"] == "user_admin") {
    if ($_POST["mode"] == "update") {
        if (isset($_POST["username"])) {
            // $tqvar = addslashes(trim($_POST["username"]));