\n"; //the form was submitted //put the post array into vars $name = strip_tags(trim($_POST['name'])); $email = strip_tags(trim($_POST['email'])); $comment = strip_tags(trim($_POST['comment'])); //values from the hidden vars $section_id = intval($_POST['section_id']); $section_type = $_POST['section_type']; $identifier = $_POST['identifier']; //inititialise an error array $errors = array(); //validate the user input if(empty($name)) { $errors[] = 'Name must be filled in and contain text only'; } if(!valid_email($email)) { $errors[] = 'Email must be in the following format - name@yourdomain.com'; } if(!valid_textarea($comment)) { $errors[] = 'Comment is required'; } //ensure that the section_id is numeric - protect from malicious attacks if((!is_numeric($section_id))||($section_id < 1)) { $errors[] = 'Section ID must be numeric'; } //ensure that the identifier is = 32 digits - protect from malicious attacks if((strlen($identifier)!=32)) { $errors[] = 'Identifier is invalid'; } if(!empty($gravity_field)) $errors[] = ''; //check the value of the error variable //if there were no errors, then we process if (count($errors)== 0) { //attempt to insert into the db if(insert_comments($section_id, $comment, $name, $email, $identifier)) { //send the email to the admin address send_approve_comments_email($name, $email, $comment, $section_id); echo "\t\t

Thankyou…

\n"; echo "\t\t

Your comments have been submitted. We will review your submission and if approved, should appear on the site within 24 hours.

\n"; } else { echo "\t\t

Error…

\n"; echo "\t\t

There was a problem submitting your comments. Please try again later.

\n"; } //build the url based on whether this is a blog pages ot section page they came from if($section_type=='blog') { $page = "blog.php"; } elseif($section=='site_section') { $page = "section.php"; } echo "

Return to the post you were viewing.

"; } else { //there were errors so display them echo "\t\t

The following errors occurred:

\n"; echo "\t\t\n"; //display the form display_comment_form($section_id, 'blog', $_POST); } } //comments form was not submitted else { //get any values from the querystring $section = intval($_GET['s']); //if there is a valid tID in querystring if((isset($section))&&(!$section=='')&&(is_numeric($section))) { //get the details of this section for display if($section_title = get_section_title($section)) { //display the top_nav and banner do_top_nav_banner($section_title." - ".$common_title, $desc); //display the sub_nav display_sub_nav(); //display the side_nav display_side_nav(); //open the main content div echo "\t
\n"; //display the comments for this section display_blog_section($section_title, $section); //display the comments form display_comment_form($section, 'blog', $_POST); } else { $title = "Invalid Section"; //display the top_nav and banner do_top_nav_banner($title." - ".$common_title, $desc); //display the sub_nav display_sub_nav(); //display the side_nav display_side_nav(); //open the main content div echo "\t
\n"; echo "\t\t

This is not a valid Section of the French BLOG…\n"; } } else { //display the top_nav and banner do_top_nav_banner($common_title, $desc); //display the sub_nav display_sub_nav(); //display the side_nav display_side_nav(); //open the main content div echo "\t

\n"; //display the blog content display_blog_content(); } } //close the main content div echo "\t
\n"; //display the html footer display_html_footer(); ?>