Example #1
0
function frm($name)
{
    if (form_post("submit")) {
        $message = "";
        foreach ($_REQUEST as $key => $value) {
            if (str_beg($key, "cb_")) {
                $message .= "{$value}\r\n";
            }
            if (str_beg($key, "f_")) {
                $caption = $_REQUEST["c_" . str_replace("f_", "", $key)];
                $message .= "{$caption}:\r\n{$value}\r\n\r\n";
            }
        }
        $from = "no-reply-site-form@" . $_SERVER['HTTP_HOST'];
        $to = setting("admin_email");
        $subject = form_post("subject");
        $local = $_SERVER['REMOTE_ADDR'] == "127.0.0.1";
        if (form_file_uploaded("uploadedfile")) {
            $tmp = $_FILES['uploadedfile']['tmp_name'];
            $fname = $_FILES['uploadedfile']['name'];
            /*           if($local) {
                         die("<pre>$message tmp[$tmp] fname[$fname]</pre>");
            		   } else {*/
            mail_attach($from, $to, $subject, $message, $tmp, $fname);
            //		   }
        } else {
            /*           if($local) {
                         die("<pre>$message</pre>");
            		   } else*/
            mail_from($to, $subject, $message, $from);
        }
        return form_post("success");
    }
    return template("form_email", "content", template("form_email_" . $name));
}
Example #2
0
File: admin.php Project: NazarK/sqp
function page_admin_pass_recover()
{
    $email = admin_email();
    $pass = db_result(db_query("SELECT admin_pass FROM settings LIMIT 1"));
    $msg = "Пароль администратора: {$pass}";
    mail_from($email, "пароль администратора", $msg, "no-reply@" . SITE_DOMAIN);
    die_no_template("Пароль выслан на почту администратора.");
}
Example #3
0
function frm($name, $email = "")
{
    if (form_post("submit")) {
        $message = "";
        foreach ($_REQUEST as $key => $value) {
            if (str_beg($key, "cb_")) {
                $message .= "{$value}\r\n";
            }
            if (str_beg($key, "f_")) {
                $caption = $_REQUEST["c_" . str_replace("f_", "", $key)];
                $message .= "{$caption}\r\n{$value}\r\n\r\n";
            }
        }
        $from = "*****@*****.**";
        if (!$email) {
            $to = setting("admin_email");
        } else {
            $to = $email;
        }
        $subject = form_post("subject");
        $local = $_SERVER['REMOTE_ADDR'] == "127.0.0.1";
        $parts = explode(";", $email);
        if (form_file_uploaded("uploadedfile")) {
            $tmp = $_FILES['uploadedfile']['tmp_name'];
            $fname = $_FILES['uploadedfile']['name'];
            if ($local) {
                echo "<pre>{$message} tmp[{$tmp}] fname[{$fname}]</pre>";
            } else {
                foreach ($parts as $reciever) {
                    mail_attach($from, $reciever, $subject, $message, $tmp, $fname);
                }
            }
        } else {
            if ($local) {
                echo "<pre>{$message}</pre>";
            } else {
                foreach ($parts as $reciever) {
                    mail_from($reciever, $subject, $message, $from);
                }
            }
        }
        return form_post("success");
    }
    return template("frm_" . $name);
}
Example #4
0
File: mail.php Project: NazarK/sqp
function page_mail_test()
{
    echo "sending email";
    mail_attach("*****@*****.**", "nazar.kuliev@gmail.com;chilavek@mail.ru", "mail attach test", "test", "bios.php", "bios.php");
    mail_from("nazar.kuliev@gmail.com;chilavek@mail.ru", "subj", "message", "*****@*****.**");
}