Your IP : 172.28.240.42


Current Path : /var/www/html/clients/td-teplouchet.ru/
Upload File :
Current File : /var/www/html/clients/td-teplouchet.ru/send.php

<?php
ini_set('display_errors', true);
error_reporting (E_ALL);

if (isset($_POST['firstname']) || isset($_POST['phone'])) {
	if (empty($_POST['firstname']) || empty($_POST['phone'])) {
		$result = 0;
		$errorMessage = "Похоже, что Вы что-то не заполниили.";
	} else {
		$firstname = $_POST['firstname'];
		$phone = $_POST['phone'];
		$idForm = $_POST['idform'];
		if (isset($_POST['email'])) {
			$email = $_POST['email'];
		} else {
			$email = "Данное поле не было заполнено";
		}
		if (isset($_POST['comment'])) {
			$comment = $_POST['comment'];
		} else {
			$comment = "Данное поле не было заполнено";
		}
		// Load SwiftMailer
		require_once 'lib/swift_required.php';
		// Create the Transport
		$transport = Swift_MailTransport::newInstance();

		// Create the Mailer using your created Transport
		$mailer = Swift_Mailer::newInstance($transport);

		// Create a message
		$message = Swift_Message::newInstance("Заявка с сайта | $idForm")
		 ->setFrom(array('info@td-teplouchet.ru' => 'Сайт ТеплоУчет'))
		 ->setTo(array('xas77@list.ru', 'cflexdesign@gmil.com', 'td-teplo@mail.ru', 'wemake@mail.ru', 'haider05@yandex.ru'))
		 ->setBody("Имя: $firstname\nТелефон: $phone\nE-mail: $email\n Вопрос: $comment")
		;
		$result = $mailer->send($message);
		$errorMessage = "Видимо, что-то пошло не так.";
		mail("$email", "Price-list TDteplouchet","\n\nhttp://td-teplouchet.ru/price/faf.pdf\nhttp://td-teplouchet.ru/price/teplokom.pdf\nhttp://td-teplouchet.ru/price/termotronic.pdf\nhttp://td-teplouchet.ru/price/vexve.xlsx\n—\nTDteplouchet\nT: 8 (843) 212-54-79");
	
		$errorMessage = "Видимо, что-то пошло не так.";
	}
} else {
	$result = 0;
	$errorMessage = "Кажется, вы по ошибке попали на эту страницу.";
}

if ($result != 0) {
echo <<<EOT
<html>
<head>
  <meta charset="utf-8">
  <title>Заявка отправлена</title>
  <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
  <link href="css/non-responsive.css" rel="stylesheet">
  <link rel="stylesheet" href="css/style.css">
</head>
<body>

<section class="main-block">	
	<div class="container success text-center">
		<h3>Ваше сообщение отправлено!</h3>
		<p>Спасибо за интерес к нашей компании<br>Наши менеджеры свяжутся с вами в ближайшее время.<p>
	</div>
</section><!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function (d, w, c) {
    (w[c] = w[c] || []).push(function() {
        try {
            w.yaCounter28202864 = new Ya.Metrika({id:28202864,
                    webvisor:true,
                    clickmap:true,
                    trackLinks:true,
                    accurateTrackBounce:true});
        } catch(e) { }
    });

    var n = d.getElementsByTagName("script")[0],
        s = d.createElement("script"),
        f = function () { n.parentNode.insertBefore(s, n); };
    s.type = "text/javascript";
    s.async = true;
    s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";

    if (w.opera == "[object Opera]") {
        d.addEventListener("DOMContentLoaded", f, false);
    } else { f(); }
})(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="//mc.yandex.ru/watch/28202864" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->	
</body>
</html>
EOT;
} else {
echo <<<EOT
<html>
<head>
  <meta charset="utf-8">
  <title>Заявка НЕ отправлена</title>
  <link rel="stylesheet" href="css/style.css">
</head>
<body>
 <div class="main-block">	 
 	<div class="confirmation error">
		 <h2>Внимание!</h2>
		 <p>Сообщение не отправлено! $errorMessage</p>
		 <a href="index.html">Вернуться на главную страницу</a>
	</div>
 </div><!-- Yandex.Metrika counter -->
<script type="text/javascript">
(function (d, w, c) {
    (w[c] = w[c] || []).push(function() {
        try {
            w.yaCounter28202864 = new Ya.Metrika({id:28202864,
                    webvisor:true,
                    clickmap:true,
                    trackLinks:true,
                    accurateTrackBounce:true});
        } catch(e) { }
    });

    var n = d.getElementsByTagName("script")[0],
        s = d.createElement("script"),
        f = function () { n.parentNode.insertBefore(s, n); };
    s.type = "text/javascript";
    s.async = true;
    s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";

    if (w.opera == "[object Opera]") {
        d.addEventListener("DOMContentLoaded", f, false);
    } else { f(); }
})(document, window, "yandex_metrika_callbacks");
</script>
<noscript><div><img src="//mc.yandex.ru/watch/28202864" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
</body>
</html>
EOT;
}
?>