Просмотр файла parkerforum2/answer.php

Размер файла: 6.5Kb
<?
setcookie("cname",$name,time()+10000000);
setcookie("cmail",$mail,time()+10000000);
setcookie("curl",$url,time()+10000000);
setcookie("cicq",$icq,time()+10000000);
if($name!="")
setcookie("flood1",blah,time()+30);
include"design/header.htm";
include"params.php";
include"colors.php";
$gettopic=file("topics.dat");
list($aid,$adate,$aauthor,$amail,$aicq,$asite,$atopic,$amsg)=split("::",$gettopic[$line]);

$answers=file("data/answers/$aid.dat");
$countanswers=count($answers);
$lastp=$countanswers/$nums;
$lastpage=intval($lastp);
$lastpage++;

$form = "
<form method=\"post\" action=\"answer.php?line=$line\">
<input type=hidden name=seenform value=y>
<table width=\"100%\" border=\"0\">
<tr>
<td colspan=\"2\">
<div align=\"center\"><font size=\"3\" face=$fonttype1 color=$fontcolor1>Ответ на тему <b>\"$atopic\"</b></font></div><BR>
</td>
</tr>
<tr>
<td width=\"22%\"><font size=\"2\" face=$fonttype1 color=$fontcolor1>Тема:</font></td>
<td width=\"78%\">
<font size=2 face=$fonttype1 color=$fontcolor1><B>RE: $atopic</B></font>
</td>
</tr>
<tr>
<td width=\"22%\"><font size=\"2\" face=$fonttype1 color=$fontcolor1>Ваше имя:*</font></td>
<td width=\"78%\">
<input type=\"text\" name=\"name\" value=\"$cname\">
</td>
</tr>
<tr>
<td width=\"22%\"><font size=\"2\" face=$fonttype1 color=$fontcolor1>Ваш E-mail:*</font></td>
<td width=\"78%\">
<input type=\"text\" name=\"mail\" value=\"$cmail\">
</td>
</tr>
<tr>
<td width=\"22%\"><font size=\"2\" face=$fonttype1 color=$fontcolor1>ICQ:</font></td>
<td width=\"78%\">
<input type=\"text\" name=\"icq\" value=\"$cicq\">
</td>
</tr>
<tr>
<td width=\"22%\"><font size=\"2\" face=$fonttype1 color=$fontcolor1>Ваш сайт:</font></td>
<td width=\"78%\">
<input type=\"text\" name=\"url\" value=\"$curl\">
</td>
</tr>
<tr valign=\"top\">
<td width=\"22%\" height=\"19\"><font size=\"2\" face=$fonttype1 color=$fontcolor1>Текст:*</font></td>
<td width=\"78%\" height=\"19\">
<textarea name=\"msg\" cols=\"50\" rows=\"20\"></textarea>
<BR>
<font size=1 face=$fonttype1 color=$fontcolor1>
[b]<b>Текст</b>[/b]<BR>
[i]<i>Текст</i>[/i]<BR>
[u]<u>Текст</u>[/u]</font>
</td>
</tr>
<tr valign=\"top\">
<td width=\"22%\" height=\"19\">&nbsp;</td>
<td width=\"78%\" height=\"19\">
<input type=\"submit\" name=\"Submit\" value=\"Ответить!\">
</td>
</tr>
</table>
</form>";

if($seenform!='y')
print$form;

if($flood1!="")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>Разрешается добавлять по одному ответу в 30 секунд!</font></div><BR>";
$er=1;
}

if ($name == "" or $mail == "" or $msg == "")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>Заполните все поля, помеченные звёздочкой (*)!</font></div><BR>";
$er = 1;
}

if (strlen($name) > $maxforname and $name != "")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>Имя не должно превышать $maxforname символов!</font></div><BR>";
$er = 1;
}

if (strlen($mail) > $maxformail and $mail != "")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>E-mail не должен превышать $maxformail символов!</font></div><BR>";
$er = 1;
}

if (!eregi("^([0-9])", $icq) and $icq != "")
{
print "<font face=$fonttype1 size=\"2\" color=$fontcolor1>ICQ-номер должен состоять из цифр!</font><br>";
$er = 1;
}

if (strlen($icq) > $maxforicq and $icq != "")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>ICQ-номер не должен превышать $maxforicq цифр!</font></div><BR>";
$er = 1;
}

if (!eregi("^([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)$", $mail) and $mail != "")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>Вы ввели некорректный E-mail адрес!</font></div><BR>";
$er = 1;
}

if (strlen($url) > $maxforurl and $url != "")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>Адрес сайта не должен превышать $maxforurl символов!</font></div><BR>";
$er = 1;
}

if (!eregi("^((http://)?)+((www)?)+(([a-z0-9_.-]+)?)[a-z0-9]+\.+[a-z]{2,4}$",$url) and $url!="")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>Вы ввели некорректный адрес сайта!</font></div><BR>";
$er = 1;
}

if (strlen($msg) > $maxformsg and $msg != "")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>Текст ответа не должен превышать $maxformsg символов!</font></div><BR>";
$er = 1;
}

$f = $maxforword;
$e = explode(" ",$msg);
for ($a = 0; $a < sizeof($e); $a++)
{
$o = strlen($e[$a]);
}
if ($o > $maxforword)
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>Слова в ответе не должны быть длиннее, чем $maxforword символов!</font></div><br>";
$er = 1;
}

if ($seenform=='y' and $er == "")
{
$date = date("d.m.Y");

$fp = @fopen("data/answers/$aid.dat","a");

$name = stripslashes($name);
$name = ereg_replace("<","&lt;",$name);
$name = ereg_replace(">","&gt;",$name);
$name = ereg_replace("::","&#58;&#58;",$name);
$name = ereg_replace("::::","&#58;&#58;&#58;&#58;",$name);
$name = ereg_replace("::::::","&#58;&#58;&#58;&#58;&#58;&#58;",$name);

$url = stripslashes($url);
$url = ereg_replace("::","&#58;&#58;",$url);
$url = ereg_replace("::::","&#58;&#58;&#58;&#58;",$url);
$url = eregi_replace("http://","",$url);
$url = eregi_replace("http:","",$url);
$url = eregi_replace("http","",$url);

$msg = ereg_replace("::","&#58;&#58;",$msg);
$msg = ereg_replace("::::","&#58;&#58;&#58;&#58;",$msg);
$msg = ereg_replace("<","&lt;",$msg);
$msg = ereg_replace(">","&gt;",$msg);
$msg = stripslashes($msg);
$msg = ereg_replace("\r","",$msg);
$msg = ereg_replace("\n","<br>",$msg);
$msg=str_replace("[b]","<b>",$msg);
$msg=str_replace("[/b]","</b>",$msg);
$msg=str_replace("[i]","<i>",$msg);
$msg=str_replace("[/i]","</i>",$msg);
$msg=str_replace("[u]","<u>",$msg);
$msg=str_replace("[/u]","</u>",$msg);

$mail = eregi_replace("mailto:","",$mail);
$mail = eregi_replace("mailto","",$mail);

$info = "$date::$name::$mail::$icq::$url::$msg::$REMOTE_ADDR\r\n";
fputs($fp,$info);
fclose($fp);

print "<meta http-equiv=refresh content='0; url=showtopic.php?line=$line&page=$lastpage'>";
}
print"<BR><font size=1 face=$fonttype1 color=$fontcolor1><div align='center'>ParkerForum 2.00<BR>powered by <a href='mailto:[email protected]'>ademan</a><BR><a href='http://khoroshun.com'><B>www.khoroshun.com</B></a></font>";
include"design/footer.htm";
?>