<?
Error_Reporting(E_ALL & ~E_NOTICE); /////////////// игнорируем ошибки
header("Content-type:text/vnd.wap.wml;charset=utf-8"); //////// тип и кодировка документа
////////////// Параметры книги /////////////////////////////////////////////////
$gl="../index.php"; /////////ссылка на главную
$admin="Admin"; ////////админ
$parad="admin"; ////////пароль админа
$zag="Guest book"; ///////// заголовок
$ydal=""; ///////// количество сообщений оствляемых на сервере. Если вы хотите, чтобы оставлялись все сообщения, то оставьте =""
//////////////////////////////////////////////////////////////////////////////
$u1=getenv('HTTP_USER_AGENT');
$brayz=strtok($u1,'/');
$currHour=date("H",time());///////////формат даты и времени
$currDate=date("d-m-y", time());
$curr=date("i", time());
$currTime=date("$currHour:i", time());
$vrem=time();
if($log!=$admin){$log="";}
if($pas!=$parad) {$log="";}
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">
<wml><card id=\"mas\" title=\"$zag\" ontimer=\"index.php?log=$log&pas=$pas\" >
<timer value=\"1\"/><p>";
///////////// выводим вмл заголовок
if($log!=""){$imja=$log;}
if($imja=="") {$ntext="";}
if($site=="http://"){$site="";}
if($mail=="@"){$mail="";}
$vsego = file("vsego.shet");
$vsego=$vsego[0];
if($vsego>0){$i=$vsego-3;} else{$i=0;} /////// количество проверяемых на повторяемсть сообщений (тут 3)
while($i <= $vsego)
{$tex=@file("zapis/$i.mess");
$utex=explode(":||:",$tex[0]);
$text=trim($utex[2]);
if($ntext==$text){$ntext="";}
$i=$i+1;}
if($ntext!=""){
$ntext=str_replace("$","ue",$ntext);
$trans2= array("Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы","Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы");
$trans1= array("JO","ZH","CH","SH","SCH","JE","JY","JA","jo","zh","ch","sh","sch","je","jy","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","'","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","'","y","РЃ","Р–","Р§","РЁ","Р©","Р","Р®","РЇ","С‘","Р¶","С‡","С€","С‰","СЌ","СЋ","СЏ","Рђ","Р‘","Р’","Р“","Р”","Р•","Р—","Р?","Р™","Рљ","Р›","Рњ","Рќ","Рћ","Рџ","Р ","РЎ","Рў","РЈ","Р¤","РҐ","Р¦","Р¬","Р«","Р°","Р±","РІ","Рі","Рґ","Рµ","Р·","Рё","Р№","Рє","Р»","Рј","РЅ","Рѕ","Рї","СЂ","СЃ","С‚","Сѓ","С„","С…","С†","СЊ","С‹");
if($trans=="y"){$ntext=str_replace($trans1,$trans2,$ntext);};
$ntext=htmlspecialchars(stripslashes($ntext));
$imja=htmlspecialchars(stripslashes($imja));
$mail=htmlspecialchars(stripslashes($mail));
$site=htmlspecialchars(stripslashes($site));
$conv1 = array(":)",":(",":E",":smok1",":smok2",":smok3",":monyment",":cvetok",":jazik",
":grin",":fack",":plach",":viking",";)",":P",":chajnik",":pozdravlenie",":ryki",
":pivo1",":best",":cool",":wc",":bye",":nika",":kiss1",":encore",":kiss2",":drun",
":love",":beer",":luv",":syper",":gost",":dont",":lamer",":roza",":gitara",":mogila");
$conv2 =array("<img src=\"sm/s1.gif\" alt=\":)\"/>",
"<img src=\"sm/s2.gif\" alt=\":(\"/>",
"<img src=\"sm/s3.gif\" alt=\":E\"/>",
"<img src=\"sm/s4.gif\" alt=\"kyrit\"/>",
"<img src=\"sm/s5.gif\" alt=\"kyrit\"/>",
"<img src=\"sm/s6.gif\" alt=\"kyrit\"/>",
"<img src=\"sm/s7.gif\" alt=\"monyment\"/>",
"<img src=\"sm/s8.gif\" alt=\"cvetok\"/>",
"<img src=\"sm/s9.gif\" alt=\"jazik\"/>",
"<img src=\"sm/s10.gif\" alt=\"grin\"/>",
"<img src=\"sm/s11.gif\" alt=\"fack\"/>",
"<img src=\"sm/s12.gif\" alt=\"plach\"/>",
"<img src=\"sm/s13.gif\" alt=\"viking\"/>",
"<img src=\"sm/s14.gif\" alt=\";)\"/>",
"<img src=\"sm/s15.gif\" alt=\":P\"/>",
"<img src=\"sm/s16.gif\" alt=\"chajnik\"/>",
"<img src=\"sm/s17.gif\" alt=\"pozdravlenie\"/>",
"<img src=\"sm/s18.gif\" alt=\"ryki\"/>",
"<img src=\"sm/s19.gif\" alt=\"pivo1\"/>",
"<img src=\"sm/s20.gif\" alt=\"best\"/>",
"<img src=\"sm/s21.gif\" alt=\"cool\"/>",
"<img src=\"sm/s22.gif\" alt=\"wc\"/>",
"<img src=\"sm/s23.gif\" alt=\"bye\"/>",
"<img src=\"sm/s24.gif\" alt=\"nika\"/>",
"<img src=\"sm/s25.gif\" alt=\"kiss\"/>",
"<img src=\"sm/s26.gif\" alt=\"encore\"/>",
"<img src=\"sm/s27.gif\" alt=\"kiss\"/>",
"<img src=\"sm/s28.gif\" alt=\"drun\"/>",
"<img src=\"sm/s29.gif\" alt=\"love\"/>",
"<img src=\"sm/s30.gif\" alt=\"beer\"/>",
"<img src=\"sm/s31.gif\" alt=\"love\"/>",
"<img src=\"sm/s32.gif\" alt=\"syper\"/>",
"<img src=\"sm/s33.gif\" alt=\"gost\"/>",
"<img src=\"sm/s34.gif\" alt=\"dont\"/>",
"<img src=\"sm/s35.gif\" alt=\"lamer\"/>",
"<img src=\"sm/s36.gif\" alt=\"roza\"/>",
"<img src=\"sm/s37.gif\" alt=\"gitara\"/>",
"<img src=\"sm/s38.gif\" alt=\"mogila\"/>");
$ntext=str_replace($conv1,$conv2,$ntext);
$trans3= array("A","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы","A","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы");
if($trans=="y"){$ntext=str_replace($trans2,$trans3,$ntext);}
$substr_count = substr_count($ntext,"http://");
$n=1; $ofset=0;
while($n <= $substr_count ){
$pozicn = strpos($ntext, "http://",$ofset);
$pozick = strpos($ntext, " ",$pozicn);
$sim=$pozick-$pozicn;
if($sim==0) {$sim="";}
if($sim!=""){$sim=$sim+1;}
$zamenstr = substr($ntext, $pozicn, $sim);
$zamenstr=trim($zamenstr);
$ntext=str_replace($zamenstr,"<a href=\"$zamenstr\">$zamenstr</a>",$ntext);
$ofset=$pozick+$pozick1+19;
$n=$n+1;}
if($obr!=""){$ntext="<b>$obr,</b> $ntext";}
$I=0;
$validation=false;
$sobaka=false;
$mail=strtolower($mail);
while($i<=strlen($mail)-1)
{
if ($mail[$i]=="й" or $mail[i]=="ц" or $mail[i]=="у" or $mail[i]=="к" or $mail[i]=="е" or $mail[i]=="н" or $mail[i]=="г" or $mail[i]=="ш" or $mail[i]=="щ" or $mail[i]=="з" or $mail[i]=="х" or $mail[i]=="ъ" or $mail[i]=="ф" or $mail[i]=="ы" or $mail[i]=="в" or $mail[i]=="а" or $mail[i]=="п" or $mail[i]=="р" or $mail[i]=="о" or $mail[i]=="л" or $mail[i]=="д" or $mail[i]=="ж" or $mail[i]=="э" or $mail[i]=="я" or $mail[i]=="ч" or $mail[i]=="с" or $mail[i]=="м" or $mail[i]=="и" or $mail[i]=="т" or $mail[i]=="ь" or $mail[i]=="б" or $mail[i]=="ю" or $mail[i]=="!" or $mail[i]=="№" or $mail[i]==";" or $mail[i]=="%" or $mail[i]==":" or $mail[i]=="?" or $mail[i]=="*" or $mail[i]=="(" or $mail[i]==")" or $mail[i]=="=" or $mail[i]=="+" or $mail[i]=="," or $mail[i]=="'" or $mail[i]=="|" or $mail[i]=="{" or $mail[i]=="}")
{$validation=true;}
}
if ($validation==true ) $mail='';
if (strpos($mail, "@")===false) $mail='';
if (strpos($mail, ".")===false) $mail='';
if (strpos($mail, " ")===true) $mail='';
$siteval=false;
if (strpos($site, ".com")==true) $siteval=true;
if (strpos($site, ".net")==true) $siteval=true;
if (strpos($site, ".ru")==true) $siteval=true;
if (strpos($site, ".su")==true) $siteval=true;
if (strpos($site, ".uk")==true) $siteval=true;
if (strpos($site, ".by")==true) $siteval=true;
if (strpos($site, ".ge")==true) $siteval=true;
if (strpos($site, ".org")==true) $siteval=true;
if (strpos($site, ".ua")==true) $siteval=true;
if (strpos($site, "http://.")==true) $siteval=true;
if ($siteval!=true) $site="";
$ipnn = gethostbyaddr($REMOTE_ADDR);
$zapis="$imja:||:$currTime/$currDate:||:$ntext:||:$mail:||:$site:||:$ipnn:||:$brayz";
$counterarray = file("vsego.shet");
$me = $counterarray[0]+1;
$fp = @fopen("vsego.shet","wb");
@fputs($fp,$me);
@fclose($fp);
$fnn=fopen("bann.mess","r+");
while (!feof($fnn))
{
$bann1=trim(fgets($fnn));
if ($bann1===$imja) $notadd=true;
}
$fnip=fopen("banip.mess","r+");
while (!feof($fnip))
{
$bann2=trim(fgets($fnip));
if ($bann2===$ipnn) $notadd=true;
}
if (!$notadd) {
$fp=fopen("zapis/$me.mess","w");
fputs($fp,"$zapis \r\n"); ////////////////// создание нового файла с сообщением с именем номера этого файла
fclose($fp);
chmod ("zapis/$me.mess", 0777);
if($ydal!=""){$del=$me-$ydal;
if($del>=1){unlink ("zapis/$del.mess");}}
print"Сообщение добавленно";}
}
else{print"При добавлении сообщения произошла ошибка. Возможно вы не заполнили одного из обязательных полей, или выпытаетесь отправить подряд несколько одинаковых сообщений,
или вы внесены в черный список. Обратитесь к администратору сайта.
";}
print "
<br/><a href=\"$gl\">На главную</a><br/>
</p></card></wml>";
?>