View file parkerforum2/newtopic.php

File size: 6.53Kb
<?
setcookie("cname",$name,time()+10000000);
setcookie("cmail",$mail,time()+10000000);
setcookie("curl",$url,time()+10000000);
setcookie("cicq",$icq,time()+10000000);
if($name!="")
setcookie("flood",blah,time()+60);
include"design/header.htm";
include"params.php";
include"colors.php";
$form="
<form method=\"post\" action=\"newtopic.php\">
<input type=hidden  name=seenform  value=y>
<table width=\"100%\" border=\"0\">
<tr>
<td colspan=\"2\">
<div align=\"center\"><b><font size=\"3\" face=$fonttype1 color=$fontcolor1>Создание новой темы</font></b></div><BR>
</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>
<td width=\"22%\"><font size=\"2\" face=$fonttype1 color=$fontcolor1>Название темы:*</font></td>
<td width=\"78%\">
<input type=\"text\" name=\"topic\">
</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 face=$fonttype1 size=1 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($flood!="")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>Разрешается добавлять по одной теме в минуту!</font></div><BR>";
$er=1;
}

if ($name == "" or $mail == "" or $topic == "" 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-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($topic) > $maxfortopic and $topic != "")
{
print "<BR><div align=\"center\"><font size=2 face=$fonttype1 color=$fontcolor1>Тема не должна превышать $maxfortopic символов!</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");

srand((double)microtime()*1000000);
$Id=uniqid(rand());
$shortid=substr($Id,5,14);

touch("data/answers/$shortid.dat");
chmod("data/answers/$shortid.dat",0777);
touch("data/seens/$shortid.dat");
chmod("data/seens/$shortid.dat",0777);
$fo=fopen("data/seens/$shortid.dat","w");
fputs($fo,"0");
fclose($fo);

$fp = @fopen("topics.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);

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

$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 = "$shortid::$date::$name::$mail::$icq::$url::$topic::$msg::$REMOTE_ADDR\r\n";
fputs($fp,$info);
fclose($fp);
print "<meta http-equiv=refresh content='0; url=index.php'>";
}
print"<BR><font size=1 face=$fonttype1><div align='center' color=$fontcolor1>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";
?>