fill($_POST); $errors = array(); $req_fields = array("firstname" => "First Name", "lastname" => "Last Name", "req_asst" => "Message"); foreach($req_fields as $field => $label) { if(!Str::has_value($contact->$field)) { $errors[] = $label . " is a required field."; } // end if } // end foreach if(Str::has_value($contact->email)) { if(!Str::validate_email($contact->email)) { $errors[] = "The email address you entered is not valid."; } // end if } else { $errors[] = "Please enter your email address."; } // end if if($site->site_recaptcha) { include("recaptcha_validate.inc"); } else { if(Str::has_value($contact->captcha)) { include("/home/cpasites/cpa/securimage/securimage.php"); $securimage = new Securimage(); if(!$securimage->check($contact->captcha)) { $errors[] = "The security code you entered is not correct."; } // end if } else { $errors[] = "Please enter the code shown in the image below."; } // end if } // end if recaptcha if(count($errors) > 0) { $_SESSION["contact"]["errors"] = $errors; $_SESSION["contact"]["object"] = serialize($contact); redirect($_SERVER["PHP_SELF"] . ((Str::has_value($_SERVER["QUERY_STRING"])) ? "?" . $_SERVER["QUERY_STRING"] : "")); } // end if // record the form submission in the "sub" table $sub = new Tbl(); $sub->site_id = $site->site_id; $sub->session_id = session_id(); $sub->sub_form = preg_replace("/\\.htm$/", "", basename($_SERVER["SCRIPT_FILENAME"])); $options = array(); $options["table"] = "sub"; $options["object"] = $sub; $db->put($options); foreach($contact as $fld_name => $fld_value) { if(($fld_name == "cmd") || ($fld_name == "captcha")) { continue; } // end foreach $sub_fld = new Tbl(); $sub_fld->sub_id = $sub->sub_id; $sub_fld->sub_fld_name = $fld_name; $sub_fld->sub_fld_value = $fld_value; $options = array(); $options["table"] = "sub_fld"; $options["object"] = $sub_fld; $db->put($options); } // end foreach // send an email to the contact address of the site containing the information from this form $options = array(); $options["to"] = (trim($site->site_email_info) != "") ? $site->site_email_info : $site->site_email; $options["from"] = "contact-form@byftools.com"; $options["from_name"] = $contact->firstname . " " . $contact->lastname; $options["reply_to"] = $contact->email; $options["subject"] = "Website Contact Form"; $options["body"] = "Name: " . $contact->firstname . " " . $contact->lastname . "\n"; if(Str::has_value($contact->comp)) { $options["body"] .= "Company: " . $contact->comp . "\n"; } // end if if(Str::has_value($contact->address)) { $options["body"] .= "Address: " . $contact->address . "\n"; } // end if if(Str::has_value($contact->address2)) { $options["body"] .= "Address 2: " . $contact->address2 . "\n"; } // end if if(Str::has_value($contact->city) || Str::has_value($contact->state) || Str::has_value($contact->zip)) { $options["body"] .= "City State Zip: " . $contact->city . " " . $contact->state . " " . $contact->zip . "\n"; } // end if if(Str::has_value($contact->phone)) { $options["body"] .= "Phone: " . $_POST["phone"] . "\n"; } // end if if(Str::has_value($contact->email)) { $options["body"] .= "Email: " . $contact->email . "\n"; } // end if $options["body"] .= "Message: " . $_POST["req_asst"] . "\n"; $options["body"] .= "\nForm submitted from " . (($_SERVER["HTTPS"]) ? "https" : "http") . "://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; Email::send($options); // if the site's mailing list is turned on, check if the email address submitted is in the list already; if not, add them if($site->site_mlist) { $query = "SELECT mlist_id FROM mlist WHERE mlist_email = '" . addslashes($contact->email) . "'" . " AND site_id='" . addslashes($site->site_id) . "';"; $mlist_result = $db->query($query); if($mlist_result->count() == 0) { $mlist = new Tbl(); $mlist->site_id = $site->site_id; $mlist->mlist_name = $contact->firstname . " " . $contact->lastname; $mlist->mlist_comp = $contact->company_name; $mlist->mlist_addr_1 = $contact->address; $mlist->mlist_addr_2 = $contact->address2; $mlist->mlist_city = $contact->city; $mlist->mlist_state = $contact->state; $mlist->mlist_zip = $contact->zip; $mlist->mlist_email = $contact->email; $mlist->mlist_phone = $contact->phone; $options = array(); $options["table"] = "mlist"; $options["object"] = $mlist; $db->put($options); } // end if } // end if site mlist unset($_SESSION["contact"]); redirect("thank_you.htm"); break; } // end switch } // end if include("head.inc"); $query = "SELECT * FROM `site_office` WHERE site_id = '" . addslashes($site->site_id) . "' ORDER BY site_office_index;"; $site_office_result = $db->query($query); ?>

Contact Us

site_id) . "';"; $page_result = $db->query($query); if($page_result->fetch() > 0) { ?>

result("page_body") ?>

fetch()) { ?>
site_office_map ?>

count() == 1) ? "Address" : $site_office->site_office_name ?>
site_office_addr_1 ?>
site_office_addr_2)) { ?> site_office_addr_2 ?>
site_office_city ?>, site_office_state ?> site_office_zip ?>

site_office_phone)) { ?>

Phone
site_office_phone ?>

site_office_fax)) { ?>

Fax
site_office_fax ?>

site_office_email)) { ?>

Email
site_office_email ?>

site_office_hours) && $site_office->site_office_hours_show) { ?>

Hours
site_office_hours ?>

The following errors occurred with your submission:

site_recaptcha) { ?>