I have a comment section and a reply to comment section on my social network. We are having some trouble with manual spammers, and I was going to limit the amount of comments someone could post a day.
Here are the insert queries for comments and reply to comments:
//COMMENTS
$query = "INSERT INTO `CysticAirwaves` ( 
                                        `FromUserID`,
                                        `ToUserID`,
                                        `comment`,
                                        `status`,
                                        `statusCommentAirwave`,
                                        `date`,
                                        `time`
                                ) VALUES (
                                    '" . $auth->id ."',
                                    '" . $prof->id ."',
                                    '" . mysql_real_escape_string($_POST['ProfileComment']) ."',
                                    'active',
                                    'active',
                                    '" . date("Y-m-d") . "',
                                    '" . date("G:i:s") . "')";
    mysql_query($query,$connection); 
    if($auth->id == $prof->id) {
        $just_inserted = mysql_insert_id();
        $query = "UPDATE `CysticAirwaves` SET `status` = 'dead' WHERE `FromUserID` = '" . $auth->id . "' AND `ToUserID` = '" . $prof->id . "' AND `id` != '" . $just_inserted . "'";
        $request = mysql_query($query,$connection);
}
//REPLIES
$query = "INSERT INTO `CysticAirwaves_replies` (
                                    `AirwaveID`,
                                    `FromUserID`,
                                    `comment`,
                                    `status`,
                                    `date`,
                                    `time`
                                ) VALUES (
                                    '" . mysql_real_escape_string($_POST['comment']) . "',
                                    '" . $auth->id . "',
                                    '" . mysql_real_escape_string($_POST['reply']) . "',
                                    'active',
                                    '" . date("Y-m-d") . "',
                                    '" . date("G:i:s") . "'
                                    )";
    mysql_query($query,$connection);
    $mailto = array();
    /* get the person that wrote the inital comment */
    $query = "SELECT `FromUserID` FROM `CysticAirwaves` WHERE `id` = '" . mysql_real_escape_string($_POST['comment']) . "' LIMIT 1";
    $request = mysql_query($query,$connection);
    $result = mysql_fetch_array($request);
    $comment_author = new User($result['FromUserID']);
thanks in advance
 
     
     
     
    