Example #1
0
$utm = $_POST['utm'];
$sitename = $_POST['sitename'];
$formname = $_POST['formname'];
$maillist = explode('|', $_POST['emailsarr']);
$headers = "Content-type: text/html; charset=utf-8 \r\n";
$headers .= "From: {$sitename}\r\n";
$td1_style = "border: 1px solid #000; max-width: 140px; padding: 5px 10px; font-weight: bold; background-color: #e8e8e8;";
$td2_style = "border: 1px solid #000; max-width: 460px; min-width: 300px; padding: 5px 10px;";
if ($_POST['oform'] == 1 || $_POST['oform'] == 2) {
    !empty($_POST['name']) ? $name = $_POST['name'] : ($name = "");
    !empty($_POST['phone']) ? $phone = $_POST['phone'] : ($phone = "");
    !empty($_POST['email']) ? $email = $_POST['email'] : ($email = "");
    !empty($_POST['arr_basket']) ? $arr_basket = $_POST['arr_basket'] : ($arr_basket = "");
    require "php/class.php";
    $obj = new Product();
    $result = $obj->insert_zakaz($name, $phone, $email, $arr_basket);
    echo json_encode($result);
}
$msg_top = "\n\t\t<html>\n\t\t\t<body>\n\t\t\t\t<table style=\"border-collapse: collapse;\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style=\"{$td1_style}\">Имя</td>\n\t\t\t\t\t\t<td style=\"{$td2_style}\">{$name}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style=\"{$td1_style}\">Номер телефона</td>\n\t\t\t\t\t\t<td style=\"{$td2_style}\">{$phone}</td>\n\t\t\t\t\t</tr>";
$msg_bot = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style=\"{$td1_style} vertical-align: top;\">Реферер</td>\n\t\t\t\t\t\t<td style=\"{$td2_style}\">{$ref}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style=\"{$td1_style} vertical-align: top;\">utm-метки</td>\n\t\t\t\t\t\t<td style=\"{$td2_style}\">{$utm}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</body>\n\t\t</html>";
$msg_mail = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style=\"{$td1_style}\">Электронный адрес</td>\n\t\t\t\t\t\t<td style=\"{$td2_style}\">{$email}</td>\n\t\t\t\t\t</tr>";
$msg_ques = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style=\"{$td1_style} vertical-align: top;\">Вопрос</td>\n\t\t\t\t\t\t<td style=\"{$td2_style}\">{$ques}</td>\n\t\t\t\t\t</tr>";
if (!empty($_POST['callback'])) {
    $subject = "{$sitename} | Заказ звонка";
    $message = $msg_top . $msg_bot;
}
if (!empty($_POST['request'])) {
    $subject = "{$sitename} | Заявка {$formname}";
    $message = $msg_top . $msg_mail . $msg_bot;
}
if (!empty($_POST['question'])) {