The first name is a required field, please enter it.' . "\n";
if ($lastname == '') $errors .= '
The last name is a required field, please enter it.' . "\n";
if ($street_address == '') $errors .= 'The street address is a required field, please enter it.' . "\n";
if ($city == '') $errors .= 'The city name is a required field, please enter it.' . "\n";
if ($state == '') $errors .= 'The state is a required field, please enter it.' . "\n";
if ($zipcode == '') $errors .= 'The zip code is a required field, please enter it.' . "\n";
if ($email == '') $errors .= 'The email is a required field, please enter it.' . "\n";
if ($day_phone == '') $errors .= 'The day phone is a required field, please enter it.' . "\n";
if ($comments == '') $errors .= 'Please enter your comments/situation.' . "\n";
# was there a reCAPTCHA response?
if ($_SESSION['human'] != 'y'){
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
$captcha_error = $resp->error;
$errors .= '' . $captcha_error . '' . "\n";
$error = $captcha_error;
} else {
$_SESSION['human'] = 'y';
}
}
if ($errors == ''){
//process the form
unset($_SESSION['human']);
$action_label = 'New Estimate Request';
$day_phone = $day_phone . $day_phone_ext;
$evening_phone = $evening_phone . $evening_phone_ext;
$email_data .= "$firstname $lastname\n";
$email_data .= "$street_address\n";
$email_data .= "$city $state $zipcode\n\n";
if ($day_phone != '') $email_data .= "$day_phone\n";
if ($evening_phone != '') $email_data .= "$evening_phone\n";
$search_query = '';
$search_query .=" email='" . addslashes($email) . "' ";
if ($day_phone != '') $search_query .=" or (phone1='" . addslashes(strtolower($day_phone)) . "' or phone2='" . addslashes(strtolower($day_phone)) . "') ";
if ($evening_phone != '') $search_query .=" or (phone1='" . addslashes(strtolower($day_phone)) . "' or phone2='" . addslashes(strtolower($day_phone)) . "') ";
$customers_id = tep_one_data("select customers_id from customers where $search_query limit 1");
if ($customers_id != '' && $customers_id != '0'){
// we found an existing customer by searching with their phone number
$action_label = 'New Website Contact';
tep_db_query("INSERT INTO customers_messages (customers_messages_id, customers_id, ref_url, comments, date_added, date_updated) VALUES ('', '" . addslashes($customers_id) . "', '" . addslashes($_SESSION['from']) . "', '" . addslashes($comments) . "', now(), now())");
} else {
// let's register as a new customer
tep_db_query("INSERT INTO customers (customers_id, firstname, lastname, company, email, phone1, phone2, fax, date_added, date_updated) VALUES ('', '" . addslashes($firstname) . "', '" . addslashes($lastname) . "', '" . addslashes($company) . "', '" . addslashes($email) . "', '" . addslashes($day_phone) . "', '" . addslashes($evening_phone) . "', '', now(), now())");
$customers_id = tep_db_insert_id();
tep_db_query("INSERT INTO customers_homes (homes_id, customers_id, name, street_address1, street_address2, city, state, zipcode, subdivision, directions, type) VALUES ('', '" . addslashes($customers_id) . "', '" . addslashes($firstname . ' ' . $lastname) . "', '" . addslashes($street_address) . "', '', '" . addslashes($city) . "', '" . addslashes($state) . "', '" . addslashes($zipcode) . "', '" . addslashes($subdivision) . "', '" . addslashes($directions) . "', 'billing')");
$homes_id = tep_db_insert_id();
tep_db_query("INSERT INTO estimate_requests (estimate_requests_id, customers_id, homes_id, cross_street, time_to_call, type_home, ref_url, heard, comments, partner, date_added) VALUES ('', '" . addslashes($customers_id) . "', '" . addslashes($homes_id) . "', '" . addslashes($cross_street) . "', '" . addslashes($time_to_call) . "', '" . addslashes($type_home) . "', '" . addslashes($_SESSION['from']) . "', '" . addslashes($heard) . "', '" . addslashes($comments) . "', '', now())");
}
if ($_SESSION['from'] != '') {
tep_db_query("INSERT INTO customers_ref_urls (id, customers_id, url, date_added, date_updated) VALUES ('', '" . addslashes($customers_id) . "', '" . addslashes($_SESSION['from']) . "', now(), now());");
}
if (COMPANY_MOBILE_EMAILS != '') mail(COMPANY_MOBILE_EMAILS, $action_label, $email_data);
add_message_to_session('Thank You! Someone will contact you within 24 hours to confirm your in-home estimate.', 'success');
redirect('index.html');
}
}
include 'header.php';
?>
Contact Us
Free Estimate Request
' . $errors . '' . "\n";
}
if ($success == 1){
echo 'Thank You! Someone will contact you within 24 hours to confirm your in-home estimate.
' . "\n";
} else {
?>
You may use the following form to contact us with any questions or use it to schedule a free estimate.
We offer free in-home estimates on gutters, covers and vinyl siding repairs, appointments are scheduled to fit
into your busy life style and will take less than an hour of your time. Please fill out the form below to schedule an estimate,
BOLD fields are required.