<?php
########################################
## WAP-ENGINE ##
########################################
## ##
## Автор : CHUMA (Токарев Владимир) ##
## e-mail : [email protected] ##
## WAP : http://wap-engine.ru ##
## ##
########################################
## ВЫ НЕ ИМЕЕТЕ ПРАВО ##
## ИЗМЕНЯТЬ КОД СКРИПТА ##
## ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ! ##
########################################
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
####################
$mail_flood = '../../data/flood_mail.txt';
$mail_flood_list = file($mail_flood);
$flood_time = time();
if(isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw)
{
$name = $login;
}
else
{
$gost = 'Гость';
$name = filter($_POST['name']);
$email = filter($_POST['email']);
}
$msg = filter($_POST['msg']);
if (empty($email))
{
$email = $emailadmina;
}
####################
$banlist = file('../../data/ban.txt');
$ip = filter($_SERVER['REMOTE_ADDR']);
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$brauzer = strtok($user_agent,' ');
$brauzer = filter($brauzer);
$ban = $brauzer.'||'.$ip;
foreach ($banlist as $key => $string)
{
if($ban == trim(array_shift($banlist)))
{
$errb = 1;
}
}
$date_now = date ('YmdHis', time() + ($sdvigclock*3600));
if($bantime > $date_now)
{
$errb = 2;
}
# Проверка на флуд
$flood = 0;
foreach ($mail_flood_list as $key => $string)
{
$flood_arr = explode('|', $string);
if(trim($flood_arr[0]) == $ip && trim($flood_arr[1]) + 30 >= $flood_time)
{
$flood = 1;
break;
}
}
# Проверка на флуд
####################
if(empty($name))
{
header('Location: index.php?err=1');
}
elseif(empty($msg))
{
header('Location: index.php?err=2');
}
elseif($gost=='Гость' && empty($_POST['imgrand']))
{
header('Location: index.php?err=3');
}
elseif($gost=='Гость' && $_POST['imgrand'] != $_SESSION['rand'])
{
header('Location: index.php?err=4');
}
elseif($gost=='Гость' && $errb == 1)
{
header('Location: index.php?err=5');
}
elseif($errb == 2)
{
header('Location: index.php?err=6');
}
elseif(isset($gost) && $dostup_mailadm == 0)
{
header('Location: index.php?err=7');
}
elseif($flood == 1)
{
header('Location: index.php?err=flood');
}
else
{
$ip = $_SERVER['REMOTE_ADDR'];
$agent = $_SERVER['HTTP_USER_AGENT'];
$date = date('d-m-Y');
$time = date('H:i:s', time());
$subject = 'Письмо с сайта '.$home;
$mail = "Письмо от $gost $name \nE-MAIL: $email \nIp: $ip \nБраузер: $agent \nОтправлено: $date ($time) \n\nСообщение: \n$msg";
$utfwin = array("А"=>"\xC0", "Б"=>"\xC1", "В"=>"\xC2", "Г"=>"\xC3", "Д"=>"\xC4", "Е"=>"\xC5", "Ё"=>"\xA8", "Ж"=>"\xC6", "З"=>"\xC7", "И"=>"\xC8", "Й"=>"\xC9", "К"=>"\xCA", "Л"=>"\xCB", "М"=>"\xCC", "Н"=>"\xCD", "О"=>"\xCE", "П"=>"\xCF", "Р"=>"\xD0", "С"=>"\xD1", "Т"=>"\xD2", "У"=>"\xD3", "Ф"=>"\xD4", "Х"=>"\xD5", "Ц"=>"\xD6", "Ч"=>"\xD7", "Ш"=>"\xD8", "Щ"=>"\xD9", "Ъ"=>"\xDA", "Ы"=>"\xDB", "Ь"=>"\xDC", "Э"=>"\xDD", "Ю"=>"\xDE", "Я"=>"\xDF", "а"=>"\xE0", "б"=>"\xE1", "в"=>"\xE2", "г"=>"\xE3", "д"=>"\xE4", "е"=>"\xE5", "ё"=>"\xB8", "ж"=>"\xE6", "з"=>"\xE7", "и"=>"\xE8", "й"=>"\xE9", "к"=>"\xEA", "л"=>"\xEB", "м"=>"\xEC", "н"=>"\xED", "о"=>"\xEE", "п"=>"\xEF", "р"=>"\xF0", "с"=>"\xF1", "т"=>"\xF2", "у"=>"\xF3", "ф"=>"\xF4", "х"=>"\xF5", "ц"=>"\xF6", "ч"=>"\xF7", "ш"=>"\xF8", "щ"=>"\xF9", "ъ"=>"\xFA", "ы"=>"\xFB", "ь"=>"\xFC", "э"=>"\xFD", "ю"=>"\xFE", "я"=>"\xFF");
$subject = strtr($subject, $utfwin);
$mail = strtr($mail, $utfwin);
$name = strtr($name, $utfwin);
$subject = convert_cyr_string($subject, 'w', 'k');
$mail = convert_cyr_string($mail, 'w', 'k');
$name = convert_cyr_string($name, 'w', 'k');
$subject = '=?KOI8-R?B?'.base64_encode($subject).'?=';
$headers = "From: \"".$name."\" <".$email.">\n";
$headers .= "X-sender: \"".$name."\" <".$email.">\n";
$headers .= "Content-Type: text/plain; charset=koi8-r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$headers .= "X-Mailer: PHP v.".phpversion();
mail($emailadmina, $subject, $mail, $headers);
# Запись в базу антифлуда
$flood_list_new = $ip.'|'.$flood_time."\r\n";
foreach ($mail_flood_list as $key => $string)
{
$flood_arr = explode('|', $string);
if(trim($flood_arr[0]) != $ip && trim($flood_arr[1]) + 30 >= $flood_time)
{
$flood_list_new .= trim($flood_arr[0]).'|'.trim($flood_arr[1])."\r\n";
}
}
write_to_file($mail_flood, $flood_list_new);
# Запись в базу антифлуда
header("Location: index.php?mailing=1&".session_name()."=".session_id()."");
}
?>