Exemple #1
0
$extra = array("form_subject" => true, "form_cc" => true, "ip" => false, "user_agent" => false);
$action = isset($_POST["action"]) ? $_POST["action"] : "";
if (empty($action)) {
    $output = "<div style='display:none'>\n        <div class='contact-top'></div>\n        <div class='contact-content'>\n                <h1 class='contact-title'>" . $sendthis . "</h1>\n                <div class='contact-loading' style='display:none'></div>\n                <div class='contact-message' style='display:none'></div>\n                <form action='#' style='display:none'>\n                  \n                        <input type='text' id='contact-name' placeholder='Представьтесь' class='q2' name='name' tabindex='1001' required />\n                       \n                        <input type='text' id='contact-phone' placeholder='Ваш телефон' class='q2' name='phone' tabindex='1002' required />";
    $output .= "\n                       <br/>\n                        <input type='submit' class='contact-send btn-send' value=" . $sendw . " tabindex='1006' />\n                        <input type='hidden' name='token' value='" . smcf_token($to) . "'/>\n                </form>\n        </div>\n</div>";
    echo $output;
} else {
    if ($action == "send") {
        $name = isset($_POST["name"]) ? $_POST["name"] : "";
        $phone = isset($_POST["phone"]) ? $_POST["phone"] : "";
        $subject = isset($_POST["subject"]) ? $_POST["subject"] : $subject;
        $message = "";
        $cc = isset($_POST["cc"]) ? $_POST["cc"] : "";
        $token = isset($_POST["token"]) ? $_POST["token"] : "";
        if ($token === smcf_token($to)) {
            smcf_send($name, $phone, $subject, $message, $cc);
            echo $ok;
        } else {
            echo $erno;
        }
    }
}
function smcf_token($s)
{
    return md5("smcf-" . $s . date("WY"));
}
function smcf_filter($value)
{
    $pattern = array("/\n/", "/\r/", "/content-type:/i", "/to:/i", "/from:/i", "/cc:/i");
    $value = preg_replace($pattern, "", $value);
    return $value;
Exemple #2
0
        $output .= "\r\n\t\t\t<label>&nbsp;</label>\r\n\t\t\t<input type='checkbox' id='contact-cc' name='cc' value='1' tabindex='1005' /> <span class='contact-cc'>Send meg en kopi</span>\r\n\t\t\t<br/>";
    }
    $output .= "\r\n\t\t\t<label>&nbsp;</label>\r\n\t\t\t<button type='submit' class='contact-send contact-button' tabindex='1006'>Send</button>\r\n\t\t\t<button type='submit' class='contact-cancel contact-button simplemodal-close' tabindex='1007'>Avbryt</button>\r\n\t\t\t<br/>\r\n\t\t\t<input type='hidden' name='token' value='" . smcf_token($to) . "'/>\r\n\t\t</form>\r\n\t</div>\r\n\t<div class='contact-bottom'><!-- <a href='http://www.ericmmartin.com/projects/simplemodal/'>Powered by SimpleModal</a>--></div>\r\n</div>";
    echo $output;
} else {
    if ($action == "send") {
        // Send the email
        $name = isset($_POST["name"]) ? $_POST["name"] : "";
        $email = isset($_POST["email"]) ? $_POST["email"] : "";
        $subject = isset($_POST["subject"]) ? $_POST["subject"] : $subject;
        $message = isset($_POST["message"]) ? $_POST["message"] : "";
        $cc = isset($_POST["cc"]) ? $_POST["cc"] : "";
        $token = isset($_POST["token"]) ? $_POST["token"] : "";
        // make sure the token matches
        if ($token === smcf_token($to)) {
            smcf_send($name, $email, $subject, $message, $cc);
            echo "Din henvendelse ble vellykket sendt.";
        } else {
            echo "Beklager, men det oppstod et problem! Prøv igjen senere.";
        }
    }
}
function smcf_token($s)
{
    return md5("smcf-" . $s . date("WY"));
}
// Validate and send email
function smcf_send($name, $email, $subject, $message, $cc)
{
    global $to, $extra;
    // Filter and validate fields
// User settings
$to = "*****@*****.**";
// Process
$action = isset($_POST["action"]) ? $_POST["action"] : "";
if (empty($action)) {
    // Send back the contact form HTML
    $output = "<div style='display:none'>\n\t<div class='contact-top'></div>\n\t<div class='contact-content'>\n\t\t<form action='data/contact.php' method='post' style='display:none'>\n\t\t\t\n            <label for='contact-phone' class='phone'>Ваш телефон:</label>\n\t\t\t<input type='text' id='contact-phone' class='contact-input phone' name='phone' tabindex='101' />\n            \n\t\t\t<button type='submit' class='contact-send contact-button' tabindex='102'>Перезвоните мне по указанному номеру</button>\n\t\t\t<br/>\n\t\t\t<input type='hidden' name='token' value='" . smcf_token($to) . "'/>\n\t\t</form>\n        <div class='contact-message' style='display:none'></div>\n        <h1 class='contact-title'></h1>\n        <h1 class='contact-title-h'>Закажите обратный звонок - мы подберем Вам наилучший вариант отдыха и мастера по программе релаксации.</h1>\n        <div class='contact-loading' style='display:none'></div>\n\t</div>\n</div>";
    echo $output;
} else {
    if ($action == "send") {
        // Send the phone
        $phone = isset($_POST["phone"]) ? $_POST["phone"] : "";
        $token = isset($_POST["token"]) ? $_POST["token"] : "";
        // make sure the token matches
        if ($token === smcf_token($to)) {
            smcf_send($phone);
            echo "Ваша заявка принята!";
        } else {
            echo "К сожалению, ваша заявка не принята...";
        }
    }
}
function smcf_token($s)
{
    return md5("smcf-" . $s . date("WY"));
}
// Validate and send email
function smcf_send($phone)
{
    global $to;
    // Filter and validate fields