You can store a timestamp in the session, plant a cookie, or store a timestamp in a database.
Session is probably the easiest, fastest and least invasive.
// 3600 seconds is 1 hour.
if ($_SESSION['last_post'] < time() + 3600)
{
//cannot post
return false;
}
// post comment.
$_SESSION['last_post'] = time();
return true
To apply to all users as a global effect use an apc cache entry or a database flag.
// 3600 seconds is 1 hour.
if (apc_fetch('comment_timeout' < time() + 3600)
{
//cannot post
return false;
}
// post comment.
apc_add('comment_timeout' , time());
return true