_Interior_2.jpg)
BACK
aircraft
financing, aircraft finance, aircraft loans, aircraft loan, airplane
loans, airplane loan, airplane financing, airplane financing, loan services
age to your webspace. IMPORTANT - The file name is case sensitive! You must save it exactly as it is named above! Do not put this script in your cgi-bin directory (folder) it may not work from there.
THAT'S IT, FINISHED!
You do not need to make any changes below this line.
*/
// Initialise variables
$errors = array();
if($_SERVER['REQUEST_METHOD'] == "POST"){$form_input = $_POST;}elseif($_SERVER['REQUEST_METHOD'] == "GET"){$form_input = $_GET;}else{exit;}
// Remove leading whitespace from all values.
function recursive_array_check(&$element_value)
{
if(!is_array($element_value)){$element_value = ltrim($element_value);}
else
{
foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check($value);}
}
return $element_value;
}
recursive_array_check($form_input);
// Check referrer is from same site.
if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
// Check for a blank form.
function recursive_array_check_blank($element_value)
{
global $set;
if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
else
{
foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}
}
}
recursive_array_check_blank($form_input);
if(!$set){$errors[] = "You cannot send a blank form";}
// Strip HTML tags from all fields.
function recursive_array_check2(&$element_value)
{
if(!is_array($element_value)){$element_value = strip_tags($element_value);}
else
{
foreach($element_value as $key => $value){$element_value[$key] = recursive_array_check2($value);}
}
return $element_value;
}
recursive_array_check2($form_input);
// ***************************
// ***** Validate name field.
if(isset($form_input['firstName']) && !empty($form_input['firstName']))
{
if($form_input['firstName'] == $form_input['lastName']){$errors[] = "The first and last name cannot be the same";}
if(preg_match("`[\r\n]`",$form_input['firstName'])){$errors[] = "You have submitted an invalid new line character";}
if(preg_match("/[^a-z' -]/i",stripslashes($form_input['firstName']))){$errors[] = "You have submitted an invalid character in the name field";}
}
// **************************
// ***** Validate Telephone field.
if(isset($form_input['telephone']) && !empty($form_input['telephone']))
{
if(!preg_match("/^[0-9\-\(\)\ ]+$/",$form_input['telephone'])){$errors[] = "You have submitted an invalid character in the telephone field";}
} else {
$errors[] = "Please provide a telephone number";
}
$rgx = '/^'; //beginning of string
$rgx .= '(?:\([2-9]\d{2}\)\ ?'; //either (200-999) with optional space
$rgx .= '|'; //or
$rgx .= '[2-9]\d{2}[- \.]?)'; //200-999 with optional seperator '- .'
$rgx .= '[2-9]\d{2}'; //middle 4 digits 200-999
$rgx .= '[- \.]?'; //optional seperator '- .'
$rgx .= '\d{4}'; //last 4 digits 0000-9999
$rgx .= '[- \.]?'; //optional seperator '- .'
$rgx .= '(?:x|ext)?\.?\ ?\d{0,5}'; //optional extension
$rgx .= '$/'; //end of string
if (!preg_match($rgx, $form_input['telephone'])){
$errors[] = "Please submit a valid phone number (e.g. \"(555) 555-5555\")";
}
// ***************************
// ***** Validate email field.
if(isset($form_input['email']) && !empty($form_input['email']))
{
if(preg_match("`[\r\n]`",$form_input['email'])){$errors[] = "You have submitted an invalid new line character";}
if(!preg_match('/^([a-z][a-z0-9_.-\/\%]*@[^\s\"\)\?<>]+\.[a-z]{2,6})$/i',$form_input['email'])){$errors[] = "Email address is invalid";}
} else {
$errors[] = "Please provide an email address";
}
// Display any errors and exit if errors exist.
if(count($errors)){foreach($errors as $value){print "$value
";} exit;}
// *****************************
// **** GEO-Locate
$geoloc = GeoCityLocateIspOrg::getInstance();
$geoloc->setLicenceKey("lRjCKiP8bZwj");
$geoloc->setIP($_SERVER['REMOTE_ADDR']);
if( $geoloc->isError() ){
$geoIPData = $geoloc->getError();
}
else {
$geoIPData = "Country Code: " . $geoloc->getCountryCode() ."\n" .
"State: " . $geoloc->getState() ."\n".
"City: " . $geoloc->getCity() ."\n".
"Zip: " . $geoloc->getZip() ."\n".
"Area Code: " . $geoloc->getAreaCode() ."\n".
"ISP: " . $geoloc->getISP() ."\n".
"Org.: " . $geoloc->getOrganization() ."\n";
}
// Build message.
function build_message($request_input){if(!isset($message_output)){$message_output = "";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!is_numeric($key)){$message_output .= "\n\n".$key.": ".build_message($value);}else{$message_output .= "\n\n".build_message($value);}}}return $message_output;}
$message = build_message($form_input);
$message = $message . "\n\n-- \nIP: " . $_SERVER['REMOTE_ADDR'];
$message = $message . "\nAgent: " . $_SERVER['HTTP_USER_AGENT'];
$message = $message . "\n" . $geoIPData;
$message = $message . "\n\n-- \nForm Location: " . $_SERVER['HTTP_REFERER'];
$message = $message . "\n\nActivity Path: " . $_SESSION['track'];
$message = stripslashes($message);
$subject = "Internet Lead - MAA - " . $form_input['firstName'] . ' ' . $form_input['lastName'];
$headers = "From: " . $form_input['email'] . "\n" . "Return-Path: " . $form_input['email'] . "\n" . "Reply-To: " . $form_input['email'] . "\n";
mail($my_email,$subject,$message,$headers);
?>