Просмотр файла NuclearCMS_v.1.0.0/chat/guestttr.php

Размер файла: 8.29Kb
<?
Error_Reporting(E_ALL & ~E_NOTICE);


if ($login!="") {












$currHour=date("H",time());
	$currDate=date("dS F, Y", time());
	$currTime=date("$currHour:i:s", time());

if ($met==bz) {
$yv=$obr  ;

if ($mess!="") {

  




$login = htmlspecialchars(stripslashes($login));

  $mess = htmlspecialchars(stripslashes($mess));
$k="";
if ($tr!=5) {
$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\"/>");







$me=$mess;
$mess=str_replace($conv1,$conv2,$me);   };

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

$mess=str_replace($trans1,$trans2,$mess);		
	};



$text = "

<b>
<a href=\"napis.php?login=\$login&amp;obr=$obr2\">$login</a>
</b>  ($currTime): <br/>
$yv $mess
<br/>______<br/>";               /////////////////формат записи в файл нового сообщения


$af = @implode("",@file("af.txt"));   
$af = trim($af);
if ($mess!=$af) {


$counterarray = file("counter.dat");
$id = $counterarray[0]+1;
$fp = @fopen("counter.dat","wb");
@fputs($fp,$id);
@fclose($fp);

$nomer = "$id";

 if($id>50) { $delfile = $id - 50;
unlink ("rek/$delfile.txt"); };     ///////////////////      удаление старых файлов, на сервере сохраняется 50 последних сообщений  (при желании можно изменить)





$fp=fopen("rek/$id.txt","w");
fputs($fp,"$text \r\n");                                     ////////////////// создание нового файла с сообщением с именем номера этого файла
fclose($fp);                                                

$fp=fopen("af.txt","w");
fputs($fp,"$mess \r\n");
fclose($fp); 
 };  }; }  



header("Content-type:text/vnd.wap.wml;charset=UTF-8");
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">
<wml>
<card id=\"tes\" title=\"Nash chat\" ontimer=\"guestttr.php?login=$login&amp;new=$id&amp;met=b\" > 
<timer value=\"600\"/>   <p>
<do type=\"accept\" name=\"newp\" label=\"Napisat'\"><go href=\"napistr.php?login=$login&amp;obr=&amp;mess=\"/></do>
<do type=\"accept\" name=\"newp2\" label=\"Obnovit'\"><go href=\"guestttr.php?login=$login&amp;new=$id&amp;met=b\"/></do>





 ";     ////////// значение  timer можно изменить на другое желаемое значение для автообновления в децесекундах


$id = @implode("",@file("counter.dat"));
if ($nomber == 0)  $nomber = "$id" ;



print "<br/> $currTime <br/>========<br/>";                                 ////////////////// вывод на печать даты и времени
$trans1= array("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","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","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","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","sh","SH","e","E","'","'","e","E","napistr"	
		
		);
	
	
$trans2= array("&#x0427;","&#x0428;","&#x042E;","&#x042F;","&#x0410;","&#x0411;","&#x0412;","&#x0413;","&#x0414;","&#x0415;","&#x0416;","&#x0417;","&#x0418;","&#x041A;","&#x041B;","M","&#x041D;","&#x041E;","&#x041F;","&#x0420;","&#x0421;","&#x0422;","&#x0423;","&#x0424;","&#x0425;","&#x0426;","&#x042B;","&#x0447;","&#x0448;","&#x044E;","&#x044F;","&#x0430;","&#x0431;","&#x0432;","&#x0433;","&#x0434;","&#x0435;","&#x0436;","&#x0437;","&#x0438;","&#x043A;","&#x043B;","&#x043C;","&#x043D;","&#x043E;","&#x043F;","&#x0440;","&#x0441;","&#x0442;","&#x0443;","&#x0444;","&#x0445;","&#x0446;","&#x044C;","&#x044B;","&#x0419;","&#x0439;",
	"Р§","РЁ","Р®","РЇ","Рђ","Р‘","Р’","Р“","Р”","Р•","Р–","Р—","Р?","Рљ","Р›","Рњ","Рќ","Рћ","Рџ","Р ","РЎ","Рў","РЈ","Р¤","РҐ","Р¦","Р«","С‡","С€","СЋ","СЏ","Р°","Р±","РІ","Рі","Рґ","Рµ","Р¶","Р·","Рё","Рє","Р»","Рј","РЅ","Рѕ","Рї","СЂ","СЃ","С‚","Сѓ","С„","С…","С†","СЊ","С‹","Р™","Р№","С‰","Р©","С‘","РЃ","СЉ","РЄ","СЌ","Р­","napis"	);



$var = 6;                ////////////// число сообщений на странице (чило сообщений = var + 1 !!!)
   $i = 0;
   while($i <= $var)
   

{
       

$text = @implode("",@file("rek/$nomber.txt"));                                           
$nomber = $nomber-1; 
$text=str_replace($trans2,$trans1,$text);
 print "$text"; $i=$i+1; 





};










print "<br/>




<a href=\"napistr.php?login=$login&amp;mess=&amp;obr=\">Napisat'</a><br/>

<a href=\"guestttr.php?nomber=$nomber&amp;login=$login&amp;met=b\">Dalee</a><br/>
<a href=\"dwap.php?dwap=smiletr&amp;login=$login&amp;new=$id\">Spravka po smajlam</a><br/>

<a href=\"index.wml\">Glavnaia</a>
</p> </card></wml>";    } 
//////////////////////////////вывод на страницу ссылок на главную, написать и следующие сообщения.

else {
header("Content-type:text/vnd.wap.wml;charset=UTF-8");
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=\"tes\" title=\"&#x041D;&#x0430;&#x0448; &#x0447;&#x0430;&#x0442;\"><p>


&#x0412;&#x0435;&#x0440;&#x043D;&#x0438;&#x0442;&#x0435;&#x0441;&#x044C; &#x043D;&#x0430;&#x0437;&#x0430;&#x0434; &#x0438; &#x0432;&#x0432;&#x0435;&#x0434;&#x0438;&#x0442;&#x0435; &#x043B;&#x043E;&#x0433;&#x0438;&#x043D;!<br/>


<a href=\"index.wml\">&#x041D;&#x0430; &#x0433;&#x043B;&#x0430;&#x0432;&#x043D;&#x0443;&#x044E;</a><br/>
</p>

</card>
</wml>";}

?>