<?php
##############################
## WAP-GUEST ##
##############################
## ##
## Автор : CHUMA ##
## e-mail : [email protected] ##
## WAP : http://wapeng.info ##
## ICQ : 13-14-11 ##
## ##
## Модификатор: Jeri ##
## e-mail: [email protected] ##
## wap: http://Jeri.h2m.ru ##
## ##
##############################
## ВЫ НЕ ИМЕЕТЕ ПРАВО ##
## ИЗМЕНЯТЬ КОД СКРИПТА ##
## ДЛЯ ДАЛЬНЕЙШЕГО ##
## РАСПРОСТРАНЕНИЯ ##
##############################
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
session_name("SES");
session_start();
include ("templates/tr_to_win.php");
include ("config.php");
$base = 'gb.txt';
if ($_SESSION['login']==$nickadmina && md5($_SESSION['pass'])==$passadmina)
{
$name = $nickadmina;
if(!empty($_POST["for"]))
{
$for = "$_POST[for]";
$for = trim($for);
$for = stripslashes($for);
$for = htmlspecialchars($for);
$for = str_replace('|', '', $for);
if(strlen($for) > 20)
{
$err = "Имя \"кому\" не должно быть длиньше 20-ти символов<br>";
}
}
$email = "$mailadmina";
$url = "$home";
$msg = "$_POST[msg]";
$name = trim($name);
$email = trim($email);
$email = str_replace('|', '', $email);
$url = trim($url);
$msg = trim($msg);
$url = str_replace('http://','',$url);
$url = str_replace('|', '', $url);
$msg = stripslashes($msg);
$msg = htmlspecialchars($msg);
$msg = str_replace('|', '', $msg);
$name = stripslashes($name);
$name = htmlspecialchars($name);
$name = str_replace('|', '', $name);
if ($_POST[msgtrans]==1)
{
$msg = tr_to_win($msg);
}
$time = date("H:i", time());
$date = date("d.m.y", time());
$ip = getenv("REMOTE_ADDR");
$user_agent = getenv("HTTP_USER_AGENT");
$brauzer = strtok($user_agent," ");
$brauzer = htmlspecialchars($brauzer);
$brauzer = str_replace('|', '', $brauzer);
$ban = "$brauzer||$ip";
if(strlen($msg) > 1000)
{
$err = "Сообщение не должно быть длиньше 1000 символов<br>";
}
if(empty($msg))
{
$err .= "Не введено сообщение<br>";
}
if(!empty($err))
{
header ("Location: add.php?err=$err");
}
if(empty($err))
{
$_SESSION['name'] = "$name";
$_SESSION['email'] = "$email";
$_SESSION['url'] = "$url";
# Начало Смайлики ;-)
$smiles_dir = opendir("smiles");
while ($file = readdir($smiles_dir))
{
if($file != "Thumbs.db" && $file != ".." && $file != ".")
{
$smiles_array[] = "<img src=\"smiles/$file\" alt=\"smiles\" />";
}
}
closedir ($smiles_dir);
sort($smiles_array);
$smiles_dir1 = opendir("smiles");
while ($file1 = readdir($smiles_dir1))
{
if($file1 != "Thumbs.db" && $file1 != ".." && $file1 != ".")
{
$file1 = explode(".", $file1);
$smiles_array1[] = ":$file1[0]:";
}
}
sort($smiles_array1);
closedir ($smiles_dir1);
# Конец Смайлики ;-)
# Начало антимат
$mat_file = file("antimat.txt");
$count_mat_file = count($mat_file);
for ($i = 0; $i <= $count_mat_file; $i++)
{
$mat = explode("::", "$mat_file[$i]");
$mat_array[] = "$mat[0]";
}
$mat_file1 = file("antimat.txt");
$count_mat_file1 = count($mat_file1);
for ($i = 0; $i <= $count_mat_file1; $i++)
{
$mat1 = explode("::", "$mat_file1[$i]");
$mat1 = str_replace('
','',"$mat1[1]");
$mat_array1[] = "$mat1";
}
# Конец антимат
# Начало BB коды
$msg = str_replace("[b]","<b>",$msg);
$msg = str_replace("[/b]","</b>",$msg);
$msg = str_replace("[i]","<i>",$msg);
$msg = str_replace("[/i]","</i>",$msg);
$msg = str_replace("[s]","<s>",$msg);
$msg = str_replace("[/s]","</s>",$msg);
$msg = str_replace("[u]","<u>",$msg);
$msg = str_replace("[/u]","</u>",$msg);
$msg = str_replace("[u]","<u>",$msg);
# Конец BB коды
$msg = str_replace($smiles_array1, $smiles_array, $msg);
$msg = str_replace($mat_array, $mat_array1, $msg);
$msg = str_replace('
', '<br/>', $msg);
$back = @file_get_contents("$base");
$file = fopen("$base","w");
flock ($file,LOCK_EX);
fputs($file,"$name|$for|$brauzer|$ip|$time|$date|$email|$url|$msg"."\r\n"."$back");
fflush ($file);
flock ($file,LOCK_UN);
fclose($file);
header ("Location: index.php");
}
}else
{
$name = "$_POST[name]";
if(!empty($_POST["for"]))
{
$for = "$_POST[for]";
$for = trim($for);
$for = stripslashes($for);
$for = htmlspecialchars($for);
$for = str_replace('|', '', $for);
if(strlen($for) > 20)
{
$err = "Имя кому не должно быть длиньше 20-ти символов<br>";
}
}
$email = "$_POST[email]";
$url = "$_POST[url]";
$msg = "$_POST[msg]";
$name = trim($name);
$email = trim($email);
$email = str_replace('|', '', $email);
$url = trim($url);
$msg = trim($msg);
$url = str_replace('http://','',$url);
$url = str_replace('|', '', $url);
$msg = stripslashes($msg);
$msg = htmlspecialchars($msg);
$msg = str_replace('|', '', $msg);
$name = stripslashes($name);
$name = htmlspecialchars($name);
$name = str_replace('|', '', $name);
if ($_POST[msgtrans]==1)
{
$msg = tr_to_win($msg);
}
if ($_POST[nametrans]==1)
{
$name = tr_to_win($name);
}
$time = date("H:i", time());
$date = date("d.m.y", time());
$ip = getenv("REMOTE_ADDR");
$user_agent = getenv("HTTP_USER_AGENT");
$brauzer = strtok($user_agent," ");
$brauzer = htmlspecialchars($brauzer);
$brauzer = str_replace('|', '', $brauzer);
$ban = "$brauzer||$ip";
if(empty($name))
{
$err = "Не введено имя<br>";
}
if(strlen($name) > 20)
{
$err = "Имя не должно быть длиньше 20-ти символов<br>";
}
if(strlen($email) > 25)
{
$err = "E-MAIL не должен быть длиньше 25-ти символов<br>";
}
if(strlen($url) > 50)
{
$err = "url не должен быть длиньше 50-ти символов<br>";
}
if(strlen($msg) > 1000)
{
$err = "Сообщение не должно быть длиньше 1000 символов<br>";
}
if(empty($msg))
{
$err .= "Не введено сообщение<br>";
}
if(empty($_POST['imgrand']))
{
$err .= "Не введено проверочное число<br>";
}
if(!empty($_POST['imgrand']))
{
if($_POST['imgrand'] != $_SESSION['rand'])
{
$err .= "Проверочное число неверно<br>";
}
}
if(!empty($email))
{
if (!preg_match("/[0-9a-z_]+@[0-9a-z_^\.]+\.[a-z]{2,3}/i", $email))
{
$err .= "Не верный формат e-mail. Введите e-mail в виде <i>[email protected]</i>!<br>";
}
}
if(!empty($err))
{
header ("Location: add.php?err=$err");
}
if(empty($err))
{
$_SESSION['name'] = "$name";
$_SESSION['email'] = "$email";
$_SESSION['url'] = "$url";
# Начало Смайлики ;-)
$smiles_dir = opendir("smiles");
while ($file = readdir($smiles_dir))
{
if($file != "Thumbs.db" && $file != ".." && $file != ".")
{
$smiles_array[] = "<img src=\"smiles/$file\" alt=\"smiles\" />";
}
}
closedir ($smiles_dir);
sort($smiles_array);
$smiles_dir1 = opendir("smiles");
while ($file1 = readdir($smiles_dir1))
{
if($file1 != "Thumbs.db" && $file1 != ".." && $file1 != ".")
{
$file1 = explode(".", $file1);
$smiles_array1[] = ":$file1[0]:";
}
}
sort($smiles_array1);
closedir ($smiles_dir1);
# Конец Смайлики ;-)
# Начало антимат
$mat_file = file("antimat.txt");
$count_mat_file = count($mat_file);
for ($i = 0; $i <= $count_mat_file; $i++)
{
$mat = explode("::", "$mat_file[$i]");
$mat_array[] = "$mat[0]";
}
$mat_file1 = file("antimat.txt");
$count_mat_file1 = count($mat_file1);
for ($i = 0; $i <= $count_mat_file1; $i++)
{
$mat1 = explode("::", "$mat_file1[$i]");
$mat1 = str_replace('
','',"$mat1[1]");
$mat_array1[] = "$mat1";
}
# Конец антимат
# Начало BB коды
$msg = str_replace("[b]","<b>",$msg);
$msg = str_replace("[/b]","</b>",$msg);
$msg = str_replace("[i]","<i>",$msg);
$msg = str_replace("[/i]","</i>",$msg);
$msg = str_replace("[s]","<s>",$msg);
$msg = str_replace("[/s]","</s>",$msg);
$msg = str_replace("[u]","<u>",$msg);
$msg = str_replace("[/u]","</u>",$msg);
$msg = str_replace("[u]","<u>",$msg);
# Конец BB коды
$msg = str_replace($smiles_array1, $smiles_array, $msg);
$msg = str_replace($mat_array, $mat_array1, $msg);
$msg = str_replace('
', '<br/>', $msg);
$back = @file_get_contents("$base");
$file = fopen("$base","w");
flock ($file,LOCK_EX);
fputs($file,"$name|$for|$brauzer|$ip|$time|$date|$email|$url|$msg"."\r\n"."$back");
fflush ($file);
flock ($file,LOCK_UN);
fclose($file);
header ("Location: index.php");
}
}
?>