"; } } elseif( strtolower( trim($HTTP_GET_VARS["action"]) ) == 'done') { //Confirm contact_header(); confirm(); contact_footer(); } else { contact_header(); contact_form('',''); contact_footer(); } ################################FUNCTIONS######################################## function contact_header() { ?> Contact Us
$value) { $VARS[$key] = htmlspecialchars(stripslashes($HTTP_POST_VARS[$key])); } } ?>
'; echo ''; echo ''; } ?>
'; echo '
Please correct the errors below

'; echo '
'; foreach($error_messages as $key=>$value) { echo '
  • ' . $key . ": " . $value . '
    '; } echo '
  • Company:
       

     

    $value) { if(!$value) { $error_messages[$key] = 'is empty or invalid'; } } //Validate the comments for possible email injection $prohibited = array //contains phrases that should be filtered - case insensitive ( "bcc:" //the biggies first ,"cc:" ,"reply-to" ,"mime-version" //some other common ones ,"multipart/mixed" ,"multipart/alternative" ,"multipart/related" ,"boundary=" ,"charset" ,"content-disposition" ,"content-type" ,"content-transfer-encoding" ,"errors-to" // more arcane but still dangerous and shouldn't be there ,"apparently-to" ,"in-reply-to" ,"message-id" ,"x-mailer" ,"x-sender" ,"x-uidl" ); foreach($prohibited as $dangerous) { if(eregi($dangerous, strtolower($comments))) { $error_messages['Comments'] = 'Your response contains text that is potentially harmful to this server. Your response has not been sent! Please try rephrasing your response. We apologise for any inconvenience.'; break; } } //Check for a valid contact email address if( !eregi("@", $email) ) { $error_messages['Email'] = 'please enter a valid email address'; } else { //check for email injection $prohibited = array //contains phrases that should be filtered - case insensitive ( "\r" ,"\n" ,"0x0A" ,"%0A" ,"0x0D" ,"%0D" ,"%0A%0D" ); foreach($prohibited as $dangerous) { if(eregi($dangerous, strtolower($email))) { $error_messages['Email'] = 'please enter a valid email address'; break; } } } return $error_messages; } function clean_var($var) { //check for email injection $prohibited = array //contains phrases that should be filtered - case insensitive ( "\r" ,"\n" ,"0x0A" ,"%0A" ,"0x0D" ,"%0D" ,"%0A%0D" ); $var = trim($var); foreach($prohibited as $dangerous) { $var = eregi_replace($dangerous, '', strtolower($var)); } return $var; } function send_email($VARS) { global $sitename; global $siteemail; //'To' email address(our address to recieve the emails from the web) $email = "ircontact@capworth.com"; //***Setting up the mail variables: //Sender's email address (the email address of the user submitting the form) $sender = $siteemail; //Subject of the email $subject = $sitename . " Contact Form: ". $VARS['subject']; //Constructing Body of the email $body .= $sitename . " Contact Form has submitted the following information:\r\n"; $body .= "First Name: ". clean_var($VARS['firstname']) ."\r\n"; $body .= "Last Name: ". clean_var($VARS['lastname']) ."\r\n"; $body .= "Company: ". clean_var($VARS['company']) ."\r\n"; $body .= "Email: ". clean_var($VARS['email']) ."\r\n"; $body .= "Subject: ". clean_var($VARS['subject']) ."\r\n"; $body .= "Comments: ". clean_var($VARS['comments']) ."\r\n"; $body = trim(stripslashes($body)); //Additional headers for the email $headers .= "From: $sender <$sender>\r\n"; $headers .= "Return-Path: <$sender>\r\n"; //Mail the email @mail($email, $subject, $body, $headers); $headers=""; } function confirm() { ?>
    Your Information was Submitted!

    Please allow 24/48 hrs (business days) to process your information.
    Thank you!