!=$_COOKIE[imgcodepage]){
echo "<font color='#aa0033'>Грешен изпълнител.</font><br />";
}
else
{
$sel = mysql_query("SELECT * from news_comment ORDER by id desc limit 1");
$fetch = mysql_fetch_array($sel);
$kom = $fetch['comment'];
$date = date("d.m.y H:i");
$time = time();
$sql = mysql_query("INSERT INTO news_comment (id, news, nick, comment, comtoday, date) VALUES (NULL, '$id', '$_POST[name]', '$_POST[comment]', '$time', '$date')") or
die(mysql_error());
$nums = mysql_query("SELECT * FROM `news` WHERE `id`='$_GET[id]'");
while ($row = mysql_fetch_array($nums)) {
$number = htmlspecialchars($row['number']);
$number++;
$sql = ("UPDATE `news` SET number='$number' WHERE id='$row[id]'");
mysql_query($sql);
}
echo "Коментара е добавен успешно.<br />";
}
}
}
}
}
else
{
$errmsg = mysql_error();
echo "$errmsg";
}
echo "<form><br>";
$query = mysql_query("SELECT * FROM `news_comment` WHERE `news`='$id' ORDER BY id DESC") or
die(mysql_error());
while ($raw = mysql_fetch_array($query))
{
$comment = $raw['comment'];
$comment = str_replace("pedal", "<font color='#aa0033'>CENSURED</font> ", "$comment");
$comment = str_replace("sex", "<font color='#aa0033'>CENSURED</font> ", "$comment");
$comment = str_replace("kopele", "<font color='#aa0033'>CENSURED</font> ", "$comment");
$comment = str_replace("umri", "<font color='#aa0033'>CENSURED</font> ", "$comment");
$comment = str_replace("duhai", "<font color='#aa0033'>CENSURED</font> ", "$comment");
$spam=mysql_query("SELECT * FROM options WHERE spam_news='1'");
if(mysql_num_rows($spam)==0){
$comment = preg_replace("/(http\:\/\/|www\.)([^\s]+)/i", "<i><b>спам..</b></i>", $comment);
}
else{
$comment = preg_replace("/(http\:\/\/|www\.)([^\s]+)/i", "<a href='http://$2' target='_blank'>$1$2</a>", $comment);
}
echo "<tr><td>
<div style='width: 402px; height: 27px; background: #DDDDDD;'> ";
echo "<font size='2'> От:</font> <span style='font-family: comic sans ms,sans-serif;'>$raw[nick] </span>
".predi($raw[comtoday],time(),true)." </div>";
// Символи на ред в коментарите
$comment = "$comment";
$comment = wordwrap($comment, 65, "<br />", true);
//
echo "<span class=\"style2\"></span>
<div style='width: 400px; border: 1px solid #DDDDDD;'>
$comment
<br /><br />
</div><br /></td>
</tr>";
}
}
}
}
?>[/quote]