<?php
if ($_POST['kap2'] == $_POST['kap'])
{
// форматирование
$_POST['mess'] = substr($_POST['mess'],0,150);
$_POST['mess'] = htmlspecialchars($_POST['mess']);
$_POST['name'] = substr($_POST['name'],0,10);
$_POST['name'] = htmlspecialchars($_POST['name']);
$_POST['mess'] = strtr($_POST['mess'],
array(
"[b]"=>"<b>",
"[/b]"=>"</b>",
"[s]"=>"<s>",
"[/s]"=>"</s>",
"[u]"=>"<u>",
"[/u]"=>"</u>",
"[c]"=>"<center>",
"[/c]"=>"</center>",
"[i]"=>"<i>",
"[/i]"=>"</i>",
"[red]"=>"<span style= color:FF0000>",
"[green]"=>"<span style= color:00B300>",
"[/color]"=>"</span>",
"\r\n"=>"<br>",
'\"'=>'"',
'\"'=>'"',
"\\'"=>"'",
));
// Смайлы
$_POST['mess'] = strtr($_POST['mess'],
array(
":)"=>"<img src=/mod/forum/smile/1.gif border=0>",
":))"=>"<img src=/mod/forum/smile/2.gif border=0></a>",
":P"=>"<img src=/mod/forum/smile/3.gif border=0></a>",
":("=>"<img src=/mod/forum/smile/4.gif border=0></a>",
":(("=>"<img src=/mod/forum/smile/5.gif border=0></a>",
":o"=>"<img src=/mod/forum/smile/6.gif border=0></a>",
"8o"=>"<img src=/mod/forum/smile/7.gif border=0></a>",
":*"=>"<img src=/mod/forum/smile/8.gif border=0></a>",
":-0"=>"<img src=/mod/forum/smile/9.gif border=0></a>",
"):("=>"<img src=/mod/forum/smile/10.gif border=0></a>",
"8-("=>"<img src=/mod/forum/smile/11.gif border=0></a>",
));
$fp = fopen ("mod/gbk/count.txt", "r");
if ($_POST['mess'] != "")
{
//count
$count = fread($fp,filesize("mod/gbk/count.txt"));
fclose ($fp);
$count++;
$fp = fopen ("mod/gbk/count.txt", "w");
fwrite ($fp, $count);
fclose ($fp);
//text
$fp = fopen ("mod/gbk/p/post.txt", "a");
fwrite ($fp, "$_POST[name]|$_POST[date]|$_POST[mess]\r\n");
fclose ($fp);
echo 'Сохранено';
}
else
{
echo 'Неверная длина сообщения.';
};
}
else
{
echo 'Код с картинки не верный.';
}
echo '<META HTTP-EQUIV="Refresh" CONTENT="2; URL=/?pg='.$pg.'">';
?>