Pozz, napravio sam 1 skriptu sa komentarima i sve radi, samo je problem sto kad refresham stranicu u FF duplira komentar a u Operi i Chrome ne
evo cijeli comments.php
<h4 class="h3-title">Comments</h4><small><?php if (!isset($_SESSION['username'])) { echo 'You must be looged in to post comments'; } ?></small>
<hr />
<?php
// list all comments
if (isset($_GET['id']))
{
$id = (int)$_GET['id'];
$list_all_comments = $comments->list_comments($id);
foreach ($list_all_comments as $comm)
{
echo '<i>' . $comm['comment_author'] . ' - <small>' . date('m F Y h.m.s', $comm['comment_date']) . '</small></i><br />';
echo '<p>' . $comm['comment_body'] . '</p><hr />';
}
}
// show comment form only for logged in users
if (isset($_SESSION['username']))
{
// form process
if (isset($_POST['comment']))
{
if (isset($_GET['id']))
{
$news_id = (int)$_GET['id'];
$author = $_SESSION['username'];
$body = trim(htmlentities($_POST['body']));
$date = time();
if (!empty($body))
{
// add_comment($author, $body, $date, $news_id)
$insert_comment = $comments->add_comment($author, $body, $date, $news_id);
// refresh page after form is submited
echo '<meta http-equiv="refresh" content="0">';
}
}
}
?>
<form action="" method="POST">
<textarea name="body" cols="75" rows="6" autofocus required></textarea><br />
<input type="submit" name="comment" value="Submit">
</form>
<?php } ?>