This commit is contained in:
Константин Белан
2024-09-13 00:43:42 +07:00
parent b1afb0f09c
commit 18e2e45585
44 changed files with 8564 additions and 218 deletions

29
send/ajax.js Normal file
View File

@@ -0,0 +1,29 @@
jQuery(document).ready(function () {
jQuery('form').submit(function () {
var formID = jQuery(this).attr('id')
var formNm = jQuery('#' + formID)
formNm.addClass('sending')
jQuery.ajax({
type: 'POST',
url: 'send/send.php',
data: formNm.serialize(),
dataType: 'json',
success: function (data, jqXHR) {
if (data.result == 'success') {
setTimeout(() => {
formNm.removeClass('sending')
jQuery('section.modal.opened').removeClass('opened')
jQuery('#modal__bg').addClass('opened')
jQuery('section.modal[data-id="success"]').addClass('opened')
}, 1000)
}
},
error: function (jqXHR, text, error) {
console.log('ошибка')
console.log(jqXHR)
console.log(error)
},
})
return false
})
})

View File

@@ -0,0 +1,40 @@
<?php
/**
* PHPMailer Exception class.
* PHP Version 5.5.
*
* @see https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
*
* @author Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk>
* @author Jim Jagielski (jimjag) <jimjag@gmail.com>
* @author Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net>
* @author Brent R. Matzelle (original founder)
* @copyright 2012 - 2020 Marcus Bointon
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
* @note This program is distributed in the hope that it will be useful - WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*/
namespace PHPMailer\PHPMailer;
/**
* PHPMailer exception handler.
*
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
*/
class Exception extends \Exception
{
/**
* Prettify error message output.
*
* @return string
*/
public function errorMessage()
{
return '<strong>' . htmlspecialchars($this->getMessage(), ENT_COMPAT | ENT_HTML401) . "</strong><br />\n";
}
}

5126
send/phpmailer/PHPMailer.php Normal file

File diff suppressed because it is too large Load Diff

1466
send/phpmailer/SMTP.php Normal file

File diff suppressed because it is too large Load Diff

73
send/send.php Normal file
View File

@@ -0,0 +1,73 @@
<?php
// ini_set('display_errors', 1);
// error_reporting(E_ALL);
require 'phpmailer/PHPMailer.php';
require 'phpmailer/SMTP.php';
require 'phpmailer/Exception.php';
if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->SMTPDebug = 0;
// $mail->isSMTP();
$mail->SMTPAuth = true;
$mail->CharSet = 'utf-8';
$mail->Host = 'mail.hosting.reg.ru';
$mail->Username = 'admin@dezhub.ru';
$mail->Password = 'vM7hA0vS0qmL1qQ4';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
// $mail->setFrom('noreply@vectortomsk.ru', 'Вектор');
$mail->setFrom('noreply@ledoffsky.agency', 'Вектор');
$mailAddress = 'kosbelan@yandex.ru';
$mail->addAddress($mailAddress);
$message = '';
foreach($_POST as $key => $value) {
preg_match("/name/", $key, $match);
if (strpos($key, 'name') !== false) {
$key = 'Имя:';
}
if (strpos($key, 'tel') !== false) {
$key = 'Номер телефона:';
}
if (strpos($key, 'types') !== false) {
$key = 'Тип блока:';
}
if (strpos($key, 'quantity') !== false) {
$key = 'Количество:';
}
if( empty($value) ) {
$key = '';
$value = '';
}
$message .= "<tr><td style='background:#f5f5f5;border-radius:10px;'><b>".$key."</b></td><td>".$value."</td></tr>";
};
$body = '
<table cellpadding="10" cellspacing="5" style="border:1px solid #ebebeb;border-radius:10px;">
<tbody>
'. $message .'
</tbody>
</table>
<p>Отправлено с сайта: <a href="https://vectortomsk.ru/">Вектор</a></p>
';
$mail->isHTML(true);
$mail->Subject = 'Заявка с сайта Вектор';
$mail->Body = $body;
if($mail->send()){
echo json_encode(array('result' => 'success'));
}
}
?>