<?PHP
header("Content-type: text/html; charset=UTF-8");
class ProcessingForm{ public $user_email;
public $user_name; public $user_text;
public $user_tell; public $admin_email;
public $user_ip;
public function __construct
(){ if($_SERVER['REQUEST_METHOD'] == "POST"){ if(empty($_POST['name']) OR
empty($_POST['email']) OR
empty($_POST['text'])) die("Не все поля заполнены!"); require 'mysql.php'; require 'ip.php'; $this->user_ip = UserIP::getIP();
$this->user_name = $this->formValid($_POST['name']);
$this->user_text = $this->formValid($_POST['text']);
$this->user_email = $this->formValid($_POST['email']);
if($_POST['tell'] != 'Ваш телефон'){ $this->user_tell = $this->formValid($_POST['tell']);
}else{ $this->user_tell = 'Нету';
} $this->sendMail();
die("Сообщение успешно отправлено"); }else{ die("Не правильное обрашение к файлу!"); } public function validEmail($email){ $pattern = '/\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6}/';
if(preg_match($pattern, $email) != 1
){ return false; }else{ return true; } } public function getAdminEmail(){ $path = '../config/admin_config.php';
return OFFLINE_EMAIL
; } else { die('Файл '.$path.' не найден!'); } } public function sendMail(){ require 'libmail.php';
$this->admin_email = $this->getAdminEmail();
$m->From($this->user_email);
$m->To($this->admin_email);
$m->Subject("Сообщение из формы online-консультанта");
$user_info = $this->getUserInfo(); $m->Body("<div style=\"padding: 15px;\"><p style=\"margin: 0; width: auto; padding-bottom: 6px; border-bottom: 1px dashed #3FA9DF; font-size: 16px; font-famyli: Arial;\">От - <span style=\"font-feight: bold; color: #0B3F6D;\">{$this->user_name}</span> E-mail - <span style=\"font-feight: bold; color: #0B3F6D;\">{$this->user_email}</span> Телефон - <span style=\"font-feight: bold; color: #0B3F6D;\">{$this->user_tell}</span> </p><div style=\"padding-top: 15px; font-size: 15px; font-famyli: Tahoma;\">{$this->user_text}</div></div><hr />{$user_info}", "html");
$m->Priority(3) ; $m->Send(); } public function getUserInfo() { $user_info = $this->getBasicInformation();
$user_moving = $this->getMoving();
$info = '<div style="float: left;
width: 779px; height: 450px;">';
$info .= '<div style="float: left;width: 300px;box-shadow: inset 0 0 10px #777;height: 100%;min-height: 100%;border-right: 1px solid #444;"><div style="padding-top: 5px; background: #548FD3; color: white;font-size: 18px;
height: 29px;text-align: center;font-family: "Helvetica", sans-serif;border-bottom: 1px solid #859199;text-shadow: 0px 1px 1px #666;">Информация</div>'; $info .= '<div style="padding: 10px;">';
foreach ($user_info as $key => $value) { $key = $this->getRussName($key);
$info .= '<div style="float: left;width: 100%;margin: 0;color: #00262F;font-size: 13px;text-align: left;font-family: tahoma, arial, verdana, sans-serif, Lucida Sans;
border-bottom: 1px solid #D8D8D8;"><div style="float: left;width: 35%;padding: 4px;font-weight: 700;
font-size: 11px;">'.$key.': </div><div style="float: left;width: 55%;padding: 4px;border-left: 1px solid #E2E2E2;overflow-x: hidden;">'.$value.'</div></div>'; } $info .= '</div></div>'; $info .= '<div style="float: left;width: 478px;box-shadow: inset 0 0 10px #777;height: 100%;min-height: 100%;"><div style="padding-top: 5px;margin: 0;background: #548FD3;color: white;font-size: 18px;
height: 29px;text-align: center;font-family: "Helvetica", sans-serif;border-bottom: 1px solid #859199;text-shadow: 0px 1px 1px #666;
background: #548FD3;">Пути по сайту (новые вверху)</div>';
$info .= '<div style="overflow: auto<?PHP
header("Content-type: text/html; charset=UTF-8");
class ProcessingForm{ public $user_email;
public $user_name; public $user_text; public $user_tell;
public $admin_email;
public $user_ip;
public function __construct(){ if($_SERVER['REQUEST_METHOD'] == "POST"){ if(empty($_POST['name']) OR empty($_POST['email']) OR empty($_POST['text'])) die("Не все поля заполнены!");
require 'mysql.php
'; require 'ip
.php
'; $this->user_ip = UserIP::getIP(); $this->user_name = $this->formValid($_POST['name
']); $this->user_text = $this->formValid($_POST['text']); $this->user_email = $this->formValid($_POST['email']); if($_POST['tell'] != 'Ваш телефон'){ $this->user_tell = $this->formValid($_POST['tell']); }else{ $this->user_tell = 'Нету'; } $this->sendMail(); die("Сообщение успешно отправлено"); }else{ die("Не правильное обрашение к файлу!");
} } public function formValid($data){ return trim(stripslashes($data)); } public function validEmail($email){ $pattern = '/\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6}/'; if(preg_match($pattern, $email) != 1){ return false; }else{ return true; } } public function getAdminEmail(){ $path = '../config/admin_config.php'; if (file_exists($path)){ require_once $path; return OFFLINE_EMAIL; } else { die('Файл '.$path.' не найден!');
} } public function sendMail(){ require 'libmail.php'; $this->admin_email = $this->getAdminEmail(); $m = new Mail('UTF-8'); $m->From($this->user_email); $m->To($this->admin_email); $m->Subject("Сообщение из формы online-консультанта"); $user_info = $this->getUserInfo(); $m->Body("<div style=\"padding: 15px;\"><p style=\"margin: 0; width: auto; padding-bottom: 6px; border-bottom: 1px dashed #3FA9DF; font-size: 16px;
font-famyli: Arial;\">От - <span style=\"font-feight: bold; color: #0B3F6D;\">{$this->user_name}</span> E-mail - <span style=\"font-feight: bold; color: #0B3F6D;\">{$this->user_email}</span> Телефон - <span style=\"font-feight: bold; color: #0B3F6D;\">{$this->user_tell}</span> </p><div style=\"padding-top: 15px; font-size: 15px; font-famyli: Tahoma;\">{$this->user_text}</div></div><hr />{$user_info}", "html"); $m->Priority(3) ; $m->Send(); } public function getUserInfo() { $user_info = $this->getBasicInformation(); $user_moving = $this->getMoving();
$info = '<div style="float: left; width: 779px; height: 450px;">'; $info .= '<div style="float: left;width: 300px;box-shadow: inset 0 0 10px #777;height: 100%;min-height: 100%;border-right: 1px solid #444;"><div style="padding-top: 5px; background: #548FD3; color: white;font-size: 18px;height: 29px;text-align: center;font-family: "Helvetica", sans-serif;border-bottom: 1px solid #859199;text-shadow: 0px 1px 1px #666;">Информация</div>'; $info .= '<div style="padding: 10px;">'; $user_info = unserialize($user_info['user_info']); foreach ($user_info as $key => $value) { $key = $this->getRussName($key);
$info .= '<div style="float: left;width: 100%;margin: 0;color: #00262F;font-size: 13px;text-align: left;font-family: tahoma, arial, verdana, sans-serif, Lucida Sans; border-bottom: 1px solid #D8D8D8;"><div style="float: left;width: 35%;padding: 4px;font-weight: 700;font-size: 11px;">'.$key.': </div><div style="float: left;width: 55%;padding: 4px;border-left: 1px solid #E2E2E2;overflow-x: hidden;">'.$value.'</div></div>'; } $info .= '</div></div>'; $info .= '<div style="float: left;width: 478px;box-shadow: inset 0 0 10px #777;height: 100%;min-height: 100%;"><div style="padding-top: 5px;margin: 0;
background: #548FD3;color: white;font-size: 18px;height: 29px;text-align: center;font-family: "Helvetica", sans-serif;border-bottom: 1px solid #859199;
text-shadow: 0px 1px 1px #666;background: #548FD3;">Пути по сайту (новые вверху)</div>'; $info .= '<div style="overflow: auto;height: 415px;padding: 10px;box-sizing: border-box;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;">'; $last_time = time(); foreach ($user_moving as $moving) { $moving['at_time'] = $last_time - $moving['at_time'];
;height: 415px;padding: 10px;box-sizing: border-box;
-moz-box-sizing: border-box;-webkit-box-sizing: border-box;">';
foreach ($user_moving as $moving) { $moving['at_time'] = $last_time - $moving['at_time'];