<?
Error_Reporting(E_ALL & ~E_NOTICE);
$brayz = "$REMOTE_ADDR ";
$u1=getenv('HTTP_USER_AGENT');
$ipad=strtok($u1,'/');
$zag="[форум]";
$currHour=date("H",time());
$currDate=date("dS F, Y", time());
$currTime=date("$currHour:i", time());
$currDate = str_replace("January","01",$currDate);
$currDate = str_replace("February","02",$currDate);
$currDate = str_replace("March","03",$currDate);
$currDate = str_replace("April","04",$currDate);
$currDate = str_replace("May","05",$currDate);
$currDate = str_replace("June","06",$currDate);
$currDate = str_replace("July","07",$currDate);
$currDate = str_replace("August","08",$currDate);
$currDate = str_replace("September","09",$currDate);
$currDate = str_replace("October","10",$currDate);
$currDate = str_replace("November","11",$currDate);
$currDate = str_replace("December","12",$currDate);
$text = @file("profil/$log.prof");
if ($text!=""){
$udata = explode(":||:",$text[0]);
$provpar=trim($udata[1]);}
if($par!=$provpar) {$log=""; $mess="";}
$name = htmlspecialchars(stripslashes($name));
$mess = htmlspecialchars(stripslashes($mess));
if ($tr==5) {
$trans1= array("E","F","CH","SH","IU","IA","A","B","V","G","D","ZH","Z","I","K","L","M","N","O","R","S","T","U","H","C","Y","ch","sh","iu","ia","a","b","v","g","d","e","zh","z","i","k","l","m","n","o","p","r","s","t","u","f","h","c","'","y","J","j","P");
$trans2= array("Е","Ф","Ч","Ш","Ю","Я","А","Б","В","Г","Д","Ж","З","И","К","Л","M","Н","О","Р","С","Т","У","Х","Ц","Ы","ч","ш","ю","я","а","б","в","г","д","е","ж","з","и","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ы","Й","й","П");
$mess=str_replace($trans1,$trans2,$mess); };
if($log!="") {$text="$log::$mess::$currDate"; $im=$log;}
else {$text="-$name-::$mess::$currDate"; $im="-$name-";}
$klmes = @implode("",@file("rek/$razd=$prazd=$tem.mes")); ///// открываем счетчик с количеством сообщений
$faf = @file("rek/$razd=$prazd=$tem=$klmes.TEXT");
$udata = explode("::",$faf[0]);
$af = $udata[1];
if ($af == $mess) {$mess="";}
if ($mess!=""){
$counter_array = file("rek/$razd=$prazd=$tem.mes");
$id = $counter_array[0]+1;
$fp = @fopen("rek/$razd=$prazd=$tem.mes","wb");
@fputs($fp,$id);
@fclose($fp); ///////////// увеличиваем счеичик сообщений в теме на 1.
$sob=$id-2;
$fp=fopen("rek/$razd=$prazd=$tem=$id.TEXT","w"); ///////// записываем сообщение
fputs($fp,"$text \r\n");
fclose($fp);
chmod ("rek/$razd=$prazd=$tem=$id.TEXT", 0777);
$counter_array = file("rek/$razd=$prazd.tem");
$id = $counter_array[0]+1;
$fp = @fopen("rek/$razd=$prazd.tem","wb");
@fputs($fp,$id);
@fclose($fp);
$text = @file("rek/$razd=$prazd=$tem.kt");
$udata = explode(":||:",$text[0]);
$del=trim($udata[5]);
unlink ("rek/$razd=$prazd=$del.sort");
$fp=fopen("rek/$razd=$prazd=$id.sort","w"); ///////// записываем сообщение
fputs($fp,"$tem \r\n");
fclose($fp);
chmod ("rek/$razd=$prazd=$id.sort", 0777);
$ntext=":||:$udata[1]:||:$udata[2]:||:$currDate / $currTime:||:$im:||:$id";
$fp=fopen("rek/$razd=$prazd=$tem.kt","w"); ///////// записываем сообщение
fputs($fp,"$ntext \r\n");
fclose($fp);
chmod ("rek/$razd=$prazd=$tem.kt", 0777);
if($log!="") {$counter_array = file("profil/$log.st");
$id = $counter_array[0]+1;
$fp = @fopen("profil/$log.st","wb");
@fputs($fp,$id);
@fclose($fp); }
}
header("Content-type:text/vnd.wap.wml;charset=utf-8");
print "<?xml version=\"1.0\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">
<wml>
<card id=\"tes\" title=\"$zag\" ontimer=\"mes.php?razd=$razd&prazd=$prazd&tem=$tem&nmes=$sob&log=$log&par=$par\" >
<timer value=\"10\"/>
<p>
сообщение добавлено
<br/>
<img src=\"st/44.gif\" alt =\"+\"/>
<a href=\"mes.php?razd=$razd&prazd=$prazd&tem=$tem&nmes=$id&log=$log&par=$par\"><font color=\"blue\">форум</font></a>
</p>
</card>
</wml>";
?>