"; // $to = "erik@pinpointdigital.com"; $to = "frankg@leesautoranch.com,salesinfo@leesautoranch.com,brianl@leesautoranch.com"; $cc = ""; $bcc = ""; // $to = "Laura Hook "; // $cc = "info@hooktechnologies.com"; $host = "localhost"; // mail server name // subject of email, includes date $subject = "Auto Loan Application Posted on ".date("m-d-Y"); // For sending mail with authorization, set authorize to true // and set username, password appropriatly $authorize = false; $username = ""; $password = ""; $headers = array ('From' => $from, 'To' => $to, 'Cc' => $cc, //'bcc'=> $bcc, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => $authorize, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); // Check for any errors sending the email if (PEAR::isError($mail)) { // an error occured, return it return $mail->getMessage(); } else { // no problems with the email return ""; // header("Location: ".$goto_after_mail); } } function show_Choices ($answer) { $valid_answers = array ( "-1" => "Select", "0" => "No", "1" => "Yes"); if ( ! isSet($answer) ) $answer = "-1"; foreach ($valid_answers as $key => $value) { print "\n"; } } function show_States ($selected_state) { $state_list = array ( 'AL'=>"Alabama", 'AK'=>"Alaska", 'AZ'=>"Arizona", 'AR'=>"Arkansas", 'CA'=>"California", 'CO'=>"Colorado", 'CT'=>"Connecticut", 'DE'=>"Delaware", 'DC'=>"District Of Columbia", 'FL'=>"Florida", 'GA'=>"Georgia", 'HI'=>"Hawaii", 'ID'=>"Idaho", 'IL'=>"Illinois", 'IN'=>"Indiana", 'IA'=>"Iowa", 'KS'=>"Kansas", 'KY'=>"Kentucky", 'LA'=>"Louisiana", 'ME'=>"Maine", 'MD'=>"Maryland", 'MA'=>"Massachusetts", 'MI'=>"Michigan", 'MN'=>"Minnesota", 'MS'=>"Mississippi", 'MO'=>"Missouri", 'MT'=>"Montana", 'NE'=>"Nebraska", 'NV'=>"Nevada", 'NH'=>"New Hampshire", 'NJ'=>"New Jersey", 'NM'=>"New Mexico", 'NY'=>"New York", 'NC'=>"North Carolina", 'ND'=>"North Dakota", 'OH'=>"Ohio", 'OK'=>"Oklahoma", 'OR'=>"Oregon", 'PA'=>"Pennsylvania", 'RI'=>"Rhode Island", 'SC'=>"South Carolina", 'SD'=>"South Dakota", 'TN'=>"Tennessee", 'TX'=>"Texas", 'UT'=>"Utah", 'VT'=>"Vermont", 'VA'=>"Virginia", 'WA'=>"Washington", 'WV'=>"West Virginia", 'WI'=>"Wisconsin", 'WY'=>"Wyoming" ); if ( ! isSet($selected_state) || empty($selected_state) ) $selected_state = "CT"; foreach ($state_list as $key => $value) { print "\n"; } } // Form Validation Routines function valid_Choice($value) { if ( $value == "-1" ) { return false; } else { return true; } } function valid_Bday($value) { $pattern = "/\d{1,2}-\d{1,2}-\d{4}/"; if (preg_match($pattern, $value ) > 0) { return true; } else { return false; } } function valid_NumMonths($value) { // note: whitespace is allowed since this field is not required // accepts numbers 0-11 $pattern = "/\d{1,2}/"; //$pattern = "/^[0-9]|[1-9][0-1]$/"; // $pattern = "/^[0-11]{1}/"; if ( empty($value) ) return true; if (preg_match($pattern, trim($value) ) > 0) { return true; } else { return false; } } function valid_NumYears($value) { // note: whitespace is allowed since this field is not required $pattern = "/[0-9]|[1-9][0-9]/"; if ( empty($value) ) return true; if (preg_match($pattern, trim($value) ) > 0) { return true; } else { return false; } } // valid name, limit length to 1-30 chars function valid_Name($value) { $pattern = "/[A-Z,a-z]+[A-Z,a-z]{1,30}/"; if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } function valid_Initial($value) { $pattern = "/[A-Z,a-z]+/"; if ( trim($value) == "" ) { // cell and work phone not required return true; } else { if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } } function valid_Street($value) { $pattern = "/[A-Z,a-z,1-9]+[A-Z,a-z,0-9]{1,45}/"; if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } function valid_SSN ($value) { $pattern = "/\d{9}/"; if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } function valid_Timeframe ($value) { $pattern = "/\d{1,2}/"; if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } function valid_HomePhone ($value) { $pattern = "/\d{10}/"; if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } function valid_Phone ($value) { $pattern = "/\d{10}/"; if ( trim($value) == "" ) { // cell and work phone not required return true; } else { if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } } function valid_Currency ($value) { // $pattern = "/\d+/"; $pattern = "/0|[1-9][0-9]*/"; if ( trim($value) == "" ) { // other income and down payment not required return true; } else { if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } } function valid_RequiredCurrency ($value) { // $pattern = "/\d+/"; $pattern = "/0|[1-9][0-9]*/"; if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } function valid_Zipcode ($value) { $pattern = "/\d{5}/"; if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } function valid_EmailAddress($value ) { $pattern = '/.*@.*\..*/'; if (preg_match($pattern, $value) > 0) { return true; } else { return false; } } function getSampleData1 ( ) { return " Finance 2007-03-20 08:24:00 Dorothy S Smith 1112223333 1112223333 1112223333 joe@asdfsdfasdf123.com Cell Phone Morning 1 1234567 Joe's Lead Service 2007 GM Hummer GTP 111223333 1978-07-11 ACE Credit Union 1 1 2500 1 P 1 Own/Buying 12345 Happy Street Apartment #29 Detroit MI 99999 USA 5 2 850 54321 Happy Road Apt 273-A Detroit MI 99999 5 11 W2 Employee Bob's Hardware Store Manager of Sales 1112223333 5 2 3000 1000 Social Security Fred's Hardware Store 1112223333 5 0 abcdefg1234567abc 1999 Pontiac Grand Am 95000 4500 GMAC "; } // Change Date format for LotProOnline: YYYY-MM-DD function format_date($bday) { $date_array = explode("-",$bday); $year = $date_array[2]; $month = $date_array[0]; $day = $date_array[1]; $new_bday = $year."-".$month."-".$day; return $new_bday; } // Sends the XML Data String to the Specified URL function sendXML($post_content) { $result = ""; // The following url is for testing only // $url = "https://www.lotproonline.com/leadacceptor.php?ACEDealerID=techsupport"; $url = "https://www.lotproonline.com/leadacceptor.php?ACEDealerID=ct0801"; $header = Array("Content-Type: application/xml"); $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $ch = curl_init( ); curl_setopt( $ch, CURLOPT_POST, 1 ); curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_content ); curl_setopt( $ch, CURLOPT_URL, $url ); // curl_setopt( $ch, CURLOPT_USERAGENT, $user_agent ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, "leesautoranch:mtO4red"); curl_setopt( $ch, CURLOPT_RETURNTRANSFER,1 ); $result = curl_exec( $ch ); //print_r(curl_getinfo($ch)); //echo "\n\ncURL error number:" .curl_errno($ch); //echo "\n\ncURL error:" . curl_error($ch); //die; curl_close( $ch ); return $result; } $message = ""; $xmldata = ""; $SSN = $_POST['SSN']; $DateOfBirth = $_POST['DateOfBirth']; $LastName = $_POST['LastName']; $FirstName = $_POST['FirstName']; $MiddleInitial = $_POST['MiddleInitial']; $EmailAddress = $_POST['EmailAddress']; $Address1 = $_POST['Address1']; $City = $_POST['City']; $State = $_POST['State']; $Zipcode = $_POST['Zipcode']; $HomePhone = $_POST['HomePhone']; $CellPhone = $_POST['CellPhone']; $ResidenceType = $_POST['ResidenceType']; $YearsAtAddress = $_POST['YearsAtAddress']; $MonthsAtAddress = $_POST['MonthsAtAddress']; $HousingPayment = $_POST['HousingPayment']; $DownPayment = $_POST['DownPayment']; $Employed = $_POST['Employed']; $Employer = $_POST['Employer']; $EmploymentType = $_POST['EmploymentType']; $YearsAtEmployer = $_POST['YearsAtEmployer']; $MonthsAtEmployer = $_POST['MonthsAtEmployer']; $MonthlyIncome = $_POST['MonthlyIncome']; $OtherIncome = $_POST['OtherIncome']; $bkrpt = $_POST['bkrpt']; $Authorization = $_POST['Authorization']; // Use CSS Classes to Indicate Invalid Data Fields // See http://www.onlamp.com/pub/a/php/2004/04/22/php_css_forms.html?page=2 $EmailAddressClass = "basictext"; $SSNClass ="basictext"; $DateOfBirthClass = "basictext"; $LastNameClass = "basictext"; $FirstNameClass = "basictext"; $MiddleInitialClass= "basictext"; $EmailAddressClass= "basictext"; $Address1Class= "basictext"; $CityClass= "basictext"; $StateClass = "basictext"; $ZipcodeClass = "basictext"; $HomePhoneClass = "basictext"; $CellPhoneClass = "basictext"; $ResidenceTypeClass = "basictext"; $YearsAtAddressClass = "basictext"; $MonthsAtAddressClass = "basictext"; $EmployedClass = "basictext"; $WorkPhoneClass = "basictext"; $EmploymentTypeClass = "basictext"; $YearsAtEmployerClass = "basictext"; $MonthsAtEmployerClass = "basictext"; $MonthlyIncomeClass = "basictext"; $OtherIncomeClass = "basictext"; $bkrptClass = "basictext"; $AuthorizeClass = "basictext"; if ($_POST['process'] == 1) { $message = ""; // Check all fields for validity if (! valid_SSN($SSN) ) { $message .= "- Enter a 9 digit SSN
"; $SSNClass = "errortext"; } if (! valid_Bday($DateOfBirth) ) { $message .= "- Enter your birthday: ex: 01-09-1975
"; $DateOfBirthClass = "errortext"; } if (! valid_EmailAddress($EmailAddress)) { $message .= "- Enter your email address, ex. user@example.com
"; $EmailAddressClass="errortext"; } if (! valid_Name($FirstName)) { $message .= "- Enter your first name
"; $FirstNameClass="errortext"; } if (! valid_Name($LastName)) { $message .= "- Enter your last name
"; $LastNameClass="errortext"; } if (! valid_Initial($MiddleInitial)) { $message .= "- Enter a valid middle initial
"; $MiddleInitialClass="errortext"; } if (! valid_Street($Address1)) { $message .= "- Enter your street address
"; $Address1Class="errortext"; } if (! valid_Name($City)) { $message .= "- Enter your city
"; $CityClass="errortext"; } if (! valid_Zipcode($Zipcode)) { $message .= "- Enter your 5 digit zip code
"; $ZipcodeClass="errortext"; } if (! valid_HomePhone($HomePhone)) { $message .= "- Enter a valid 10 digit home phone #
"; $HomePhoneClass="errortext"; } if (! valid_Phone($CellPhone)) { $message .= "- Enter a valid 10 digit cell phone #
"; $CellPhoneClass="errortext"; } if (! valid_Phone($WorkPhone)) { $message .= "- Enter a valid 10 digit work phone #
"; $WorkPhoneClass="errortext"; } if (! valid_RequiredCurrency($HousingPayment)) { $message .= "- Enter your monthly housing payment
"; $HousingPaymentClass="errortext"; } if (! valid_RequiredCurrency($MonthlyIncome)) { $message .= "- Enter your monthly income amount
"; $MonthlyIncomeClass="errortext"; } if (! valid_RequiredCurrency($DownPayment)) { $message .= "- Enter a valid down payment amount
"; $DownPaymentClass="errortext"; } if (! valid_Currency($OtherIncome)) { $message .= "- Enter a valid amount for other income
"; $OtherIncomeClass="errortext"; } if (! valid_NumMonths($MonthsAtAddress) ) { $message .= "- Enter number of months, 0-11
"; $MonthsAtAddressClass = "errortext"; } if (! valid_NumYears($YearsAtAddress) ) { $message .= "- Enter number of years, 0-99
"; $YearsAtAddressClass = "errortext"; } if (! valid_Choice($Employed) ) { $message .= "- Indicate if you are currently employed
"; $EmployedClass = "errortext"; } if (! valid_NumMonths($MonthsAtEmployer) ) { $message .= "- Enter number of months, 0-11
"; $MonthsAtEmployerClass = "errortext"; } if (! valid_NumYears($YearsAtEmployer) ) { $message .= "- Enter number of years, 0-99
"; $YearsAtEmployerClass = "errortext"; } if (! valid_Choice($Authorization) ) { $message .= "- Permission to check your credit report?
"; $AuthorizationClass = "errortext"; } if ($message == "") { // Get the Current Date & Time $leadtime = strftime("%H:%M:%S", time()); $leaddate = date("Y-m-d") . " " . $leadtime; // Generate a LeadId # using the date and a random number 0-100 srand((double)microtime()*1000000); $leadid = date("ymdh").rand(0,100); // automatically fill in a portion of the data sent $xmldata = ""; $xmldata .= ""; $xmldata .= "Finance"; $xmldata .= "".$leaddate.""; $xmldata .= "".$leadid.""; $xmldata .= "USA"; $xmldata .= "P"; $xmldata .= "Lees Auto Ranch"; // Grab all the data from the form & send it in the email message foreach ($_REQUEST as $key => $val) { // skip form data we do not need if ($key != "FormHandler1" && $key != "process" && $key != "FormHandler1_x" && $key != "FormHandler1_y") { // Fix values for yes/no dropdown menus if no answer selected if ($key == "Employed" || $key == "bkrpt" || $key == "Authorization") { if ( $val == "-1" ) { $val = ""; } } // collect data to be sent in the email (all but SSN) // if ($key != "SSN") { as of 01.03.2019 - send SSN in the email EA per IW instructions $body .= $key . " : " . $val . "\r\n"; // } // do not include employed or bankrupcty data in xml if ( $key != "Employed" && $key != "bkrpt" ) { // Change DOB to be in this format: YYYY-MM-DD if ($key == "DateOfBirth") { $val = format_date($val); } // strip leading whitespace, convert html special chars $val = htmlentities(trim($val), ENT_NOQUOTES); $xmldata .="<".$key.">".$val.""; } } } $xmldata .=""; // Substitute sample data here for testing purposes only //$xmldata = getSampleData1(); $results = sendXML($xmldata); if ($results == "SUCCESS=TRUE") { $body = "The following application was submitted with success to LotProOnline: \r\n\r\n".$body; } else { $msg = "The following application was attemped but failed submit on LotProOnline: \r\n\r\n"; $body = "The Error Message was: ".$results."\r\r\n".$body; } emailForm($body); // emailForm($xmldata); header("location: http://www.easyguaranteedautoloans.com/thankyou.php?res=$results"); } else { $message = " ** Please complete all required information **
".$message; } } ?> Guaranteed Auto Loans - Dedicated to Serving the Residents of Connecticut, Massachusetts and Rhode Island.

Auto Loan Financing Has Never Been Easier!
We Finance
YOU, Not Your Credit Score!

Application:

'. $message."
\n"; } // print out xml for debug purposes here // else { // print "".$xmldata.""; // } ?>
This application will be transmitted through our secured server.

Social Security Number: * ex. 111223333
Date of Birth: * format: mm-dd-yyyy
First Name: *
Last Name: *
Middle Initial:
Email Address: *
Street: *
City: *
State: