View file new_book_line/add.php

File size: 11.74Kb
<?




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&amp;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("&#x041;","&#x0416;","&#x0427;","&#x0428;","&#x0429;","&#x042D;","&#x042E;","&#x042F;","&#x0451;","&#x0436;","&#x0447;","&#x0448;","&#x0449;","&#x044D;","&#x044E;","&#x044F;","&#x0410;","&#x0411;","&#x0412;","&#x0413;","&#x0414;","&#x0415;","&#x0417;","&#x0418;","&#x0419;","&#x041A;","&#x041B;","&#x041C;","&#x041D;","&#x041E;","&#x041F;","&#x0420;","&#x0421;","&#x0422;","&#x0423;","&#x0424;","&#x0425;","&#x0426;","&#x042C;","&#x042B;","&#x0430;","&#x0431;","&#x0432;","&#x0433;","&#x0434;","&#x0435;","&#x0437;","&#x0438;","&#x0439;","&#x043A;","&#x043B;","&#x043C;","&#x043D;","&#x043E;","&#x043F;","&#x0440;","&#x0441;","&#x0442;","&#x0443;","&#x0444;","&#x0445;","&#x0446;","&#x044C;","&#x044B;","&#x041;","&#x0416;","&#x0427;","&#x0428;","&#x0429;","&#x042D;","&#x042E;","&#x042F;","&#x0451;","&#x0436;","&#x0447;","&#x0448;","&#x0449;","&#x044D;","&#x044E;","&#x044F;","&#x0410;","&#x0411;","&#x0412;","&#x0413;","&#x0414;","&#x0415;","&#x0417;","&#x0418;","&#x0419;","&#x041A;","&#x041B;","&#x041C;","&#x041D;","&#x041E;","&#x041F;","&#x0420;","&#x0421;","&#x0422;","&#x0423;","&#x0424;","&#x0425;","&#x0426;","&#x042C;","&#x042B;","&#x0430;","&#x0431;","&#x0432;","&#x0433;","&#x0434;","&#x0435;","&#x0437;","&#x0438;","&#x0439;","&#x043A;","&#x043B;","&#x043C;","&#x043D;","&#x043E;","&#x043F;","&#x0440;","&#x0441;","&#x0442;","&#x0443;","&#x0444;","&#x0445;","&#x0446;","&#x044C;","&#x044B;");
			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"&#x0421;&#x043E;&#x043E;&#x0431;&#x0449;&#x0435;&#x043D;&#x0438;&#x0435; &#x0434;&#x043E;&#x0431;&#x0430;&#x0432;&#x043B;&#x0435;&#x043D;&#x043D;&#x043E;";}

}




else{print"&#x041F;&#x0440;&#x0438; &#x0434;&#x043E;&#x0431;&#x0430;&#x0432;&#x043B;&#x0435;&#x043D;&#x0438;&#x0438; &#x0441;&#x043E;&#x043E;&#x0431;&#x0449;&#x0435;&#x043D;&#x0438;&#x044F; &#x043F;&#x0440;&#x043E;&#x0438;&#x0437;&#x043E;&#x0448;&#x043B;&#x0430; &#x043E;&#x0448;&#x0438;&#x0431;&#x043A;&#x0430;. &#x0412;&#x043E;&#x0437;&#x043C;&#x043E;&#x0436;&#x043D;&#x043E; &#x0432;&#x044B; &#x043D;&#x0435; &#x0437;&#x0430;&#x043F;&#x043E;&#x043B;&#x043D;&#x0438;&#x043B;&#x0438; &#x043E;&#x0434;&#x043D;&#x043E;&#x0433;&#x043E; &#x0438;&#x0437; &#x043E;&#x0431;&#x044F;&#x0437;&#x0430;&#x0442;&#x0435;&#x043B;&#x044C;&#x043D;&#x044B;&#x0445; &#x043F;&#x043E;&#x043B;&#x0435;&#x0439;, &#x0438;&#x043B;&#x0438; &#x0432;&#x044B;&#x043F;&#x044B;&#x0442;&#x0430;&#x0435;&#x0442;&#x0435;&#x0441;&#x044C; &#x043E;&#x0442;&#x043F;&#x0440;&#x0430;&#x0432;&#x0438;&#x0442;&#x044C; &#x043F;&#x043E;&#x0434;&#x0440;&#x044F;&#x0434; &#x043D;&#x0435;&#x0441;&#x043A;&#x043E;&#x043B;&#x044C;&#x043A;&#x043E; &#x043E;&#x0434;&#x0438;&#x043D;&#x0430;&#x043A;&#x043E;&#x0432;&#x044B;&#x0445; &#x0441;&#x043E;&#x043E;&#x0431;&#x0449;&#x0435;&#x043D;&#x0438;&#x0439;,
&#1080;&#1083;&#1080; &#1074;&#1099; &#1074;&#1085;&#1077;&#1089;&#1077;&#1085;&#1099; &#1074; &#1095;&#1077;&#1088;&#1085;&#1099;&#1081; &#1089;&#1087;&#1080;&#1089;&#1086;&#1082;. &#1054;&#1073;&#1088;&#1072;&#1090;&#1080;&#1090;&#1077;&#1089;&#1100; &#1082; &#1072;&#1076;&#1084;&#1080;&#1085;&#1080;&#1089;&#1090;&#1088;&#1072;&#1090;&#1086;&#1088;&#1091; &#1089;&#1072;&#1081;&#1090;&#1072;.
";}



print "
<br/><a href=\"$gl\">&#x041D;&#x0430; &#x0433;&#x043B;&#x0430;&#x0432;&#x043D;&#x0443;&#x044E;</a><br/>
</p></card></wml>";

?>