Размер файла: 4.05Kb
<?
$messa=7; //Кол сообщений на странице чата!
$linkbaseurl = base64_decode("aHR0cDovL3Ryb2ZpbW92LmNvbS5ydS93YXAv");
$trofimovindex = base64_decode("V0FQY2hhdCB2ZXIgMC4x");
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=\"WAPChat\">";
if($chat=="1")
{
echo "
<p>Ваш логин в чате
<input title=\"login\" name=\"login\" maxlength=\"10\"/><br/>
<anchor title=\"Ok\">ВХОД<br/>
<go href=\"chat.php?chat=ad\" method=\"post\">
<postfield name=\"login\" value=\"$(login)\"/>
<postfield name=\"mess\" value=\"вошел в ".date("H:i:s",time())."\"/>
</go>
</anchor></p>
";
$user_agent_string = getenv("HTTP_USER_AGENT");
$host = gethostbyaddr($REMOTE_ADDR);
$ip = $REMOTE_ADDR;
$date = date("d-m-Y",time());
$time = date('H:i:s',time());
$text = "$user_agent_string::$host::$date::$time::$ip";
$fp=fopen("counter.txt","a");
fputs($fp,"$text \r\n");
fclose($fp);
}
if($chat=="ad")
{
$text = "$login::$mess";
$text=strip_tags($text);
$fp=@fopen("chat.txt","a");
@fputs($fp,"$text \r\n");
@fclose($fp);
print"
<p>Вы вошли! Можете приступить к перегоровам!
<anchor title=\"add\">ЖМИТЕ сюда!<br/>
<go href=\"chat.php?chat=2\" method=\"post\">
<postfield name=\"login\" value=\"$login\"/>
</go>
</anchor></p>
";
}
if($chat=="2")
{
print"
<p>
<anchor title=\"add\">Написать<br/>
<go href=\"chat.php?chat=dob\" method=\"post\">
<postfield name=\"login\" value=\"$login\"/>
</go>
</anchor>
:
<anchor title=\"obn\">Обновить<br/>
<go href=\"chat.php?chat=2\" method=\"post\">
<postfield name=\"login\" value=\"$login\"/>
</go>
</anchor>
</p>
";
$xfile = @file("chat.txt");
$xfile = array_reverse($xfile);
for ($i=0;$i<$messa;$i++) {
$udata = explode("::",$xfile[$i]);
print "<p><b>$udata[0]</b>:$udata[1]<br/></p>";
}
}
if($chat=="3")
{
$text = "$login::$mess";
$text=strip_tags($text);
$fp=@fopen("chat.txt","a");
@fputs($fp,"$text \r\n");
@fclose($fp);
print"
<p>
<anchor title=\"add\">Написать<br/>
<go href=\"chat.php?chat=dob\" method=\"post\">
<postfield name=\"login\" value=\"$login\"/>
</go>
</anchor>
:
<anchor title=\"obn\">Обновить<br/>
<go href=\"chat.php?chat=2\" method=\"post\">
<postfield name=\"login\" value=\"$login\"/>
</go>
</anchor>
</p>
";
$xfile = @file("chat.txt");
$xfile = array_reverse($xfile);
for ($i=0;$i<$messa;$i++) {
$udata = explode("::",$xfile[$i]);
print "<p><b>$udata[0]</b>:$udata[1]<br/></p>";
}
}
if($chat=="dob")
{
echo "<p>Сообщение:
<input title=\"mess\" name=\"mess\"/><br/>
<anchor title=\"Ok\">OK<br/>
<go href=\"chat.php?chat=3\" method=\"post\">
<postfield name=\"mess\" value=\"$(mess)\"/>
<postfield name=\"login\" value=\"$login\"/>
</go>
</anchor></p>
";
}
print "
<br/><a href=\"$linkbaseurl\">$trofimovindex</a>
</card>
</wml>";
?>