if(isset($_POST['addComment']))
{
$post_id = $_POST['post'];
$comment = $_POST['comment'];
$comment = str_replace(":)", "<img src='images/smiles/smile.gif' alt='pic' />", $comment);
$comment = addslashes(htmlspecialchars($comment));
if (strlen($comment) == 0)
{
$error = "Попълнете всички полета!";
$bol = 1;
}
else
{
mysql_query("INSERT INTO comments (post_id, comment, author) VALUES('$post_id', '$comment', '$user')") or die (mysql_erorr());
}
$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https';
$host= $_SERVER['HTTP_HOST'];
$script= $_SERVER['SCRIPT_NAME'];
$params= $_SERVER['QUERY_STRING'];
$urlto = $protocol . '://' . $host . $script . '?' . $params;
header("Location: ".$urlto);
}