$cmtx_reply_id = 0; //reset the reply id if (cmtx_session_set()) { //if there's a session $_SESSION['cmtx_question'] = ''; //reset session $_SESSION['cmtx_captcha'] = ''; //reset session } if ($cmtx_rating != 0) { cmtx_delete_rating(); //delete guest rating if rated } } else { //if comment is a success (no approval required) if (!cmtx_page_exists()) { //if page does not exist cmtx_create_page(); //create it now } //insert user's comment into 'comments' database table cmtx_db_query("INSERT INTO `" . $cmtx_mysql_table_prefix . "comments` (`name`, `email`, `website`, `town`, `country`, `rating`, `reply_to`, `comment`, `reply`, `ip_address`, `page_id`, `is_approved`, `approval_reasoning`, `is_admin`, `is_sent`, `sent_to`, `likes`, `dislikes`, `is_sticky`, `is_locked`, `is_verified`, `dated`) VALUES ('{$cmtx_name}', '{$cmtx_email}', '{$cmtx_website}', '{$cmtx_town}', '{$cmtx_country}', '{$cmtx_rating}', '{$cmtx_reply_to}', '{$cmtx_comment}', '', '{$cmtx_ip_address}', '{$cmtx_page_id}', 1, '', '{$cmtx_is_admin}', 0, 0, 0, 0, 0, 0, 0, NOW())"); $cmtx_comment_id = cmtx_db_insert_id(); //get the ID of the comment //build the success box $cmtx_box = "<div class='cmtx_success_box'>"; $cmtx_box .= "<div class='cmtx_success_message_line_1'>"; $cmtx_box .= CMTX_SUCCESS_OPENING; $cmtx_box .= "</div>"; $cmtx_box .= "<div class='cmtx_success_message_line_2'>"; $cmtx_box .= CMTX_SUCCESS_TEXT;
function cmtx_page_setup() { //page setup global $cmtx_page_id; //globalise variables if (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'Commentics') { die; } cmtx_identifier_exists(); //check identifier exists cmtx_get_page_details(); //get page details cmtx_validate_page_details(); //validate page details if (cmtx_page_exists()) { //if the page exists $cmtx_page_id = cmtx_get_page_id(); //set its ID } else { //if the page does not exist if (cmtx_setting('delay_pages')) { //don't create the page yet $cmtx_page_id = ''; //set a blank ID } else { cmtx_create_page(); //create the page } } }