//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; $cmtx_box .= "</div>"; $cmtx_box .= "</div>"; $cmtx_box .= "<div style='clear: left;'></div>"; //add new subscriber if (cmtx_setting('enabled_notify') && isset($_POST['cmtx_notify']) && cmtx_setting('enabled_email') && !empty($cmtx_email) && !cmtx_subscriber_exists($cmtx_email, $cmtx_page_id) && !cmtx_subscriber_email_attempts($cmtx_email) && !cmtx_subscriber_ip_attempts() && !$cmtx_is_admin) { cmtx_add_subscriber($cmtx_name, $cmtx_email, $cmtx_page_id); }
function cmtx_create_page() { //create page global $cmtx_identifier, $cmtx_reference, $cmtx_url, $cmtx_mysql_table_prefix, $cmtx_page_id; //globalise variables //sanitize data $cmtx_identifier = cmtx_sanitize($cmtx_identifier, true, true); $cmtx_reference = cmtx_sanitize($cmtx_reference, true, true); $cmtx_url = cmtx_sanitize($cmtx_url, true, true); cmtx_db_query("INSERT INTO `" . $cmtx_mysql_table_prefix . "pages` (`identifier`, `reference`, `url`, `is_form_enabled`, `dated`) VALUES ('{$cmtx_identifier}', '{$cmtx_reference}', '{$cmtx_url}', 1, NOW())"); $cmtx_page_id = cmtx_db_insert_id(); }