Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start();
- //ini_set('display_errors', 'On');
- //error_reporting(E_ALL);
- /* *********** FUNCTIONS ****************** */
- function checkit($insuredName) {
- return(str_replace(array("\r", "\n", "%OA", "%oa", "%OD", "%od", "Content-Type:","BCC:","bcc:"), "", $insuredName));
- }
- function cleanUp($data) {
- $data = trim(strip_tags(htmlspecialchars($data)));
- return $data;
- }
- $referer=$_SERVER['HTTP_REFERER'];
- #print($referer);
- $refsplit=explode("?",$referer);
- #if($refsplit[0]=='http://www.tracy-driscoll.com/landingpages/auto/quote2.html'){
- $errorFields = array();
- if (isset($_POST['submit'])) {
- echo "got to this stage<br />";
- $insuredName =cleanUp($_POST['insuredName']);
- $address=cleanUp($_POST['address']);
- $city=cleanUp($_POST['city']);
- $state=cleanUp($_POST['state']);
- $zip=cleanUp($_POST['zip']);
- $phone=cleanUp($_POST['phone']);
- $email=cleanUp($_POST['email']);
- $dobMonth=cleanUp($_POST['dobMonth']);
- $dobDay=cleanUp($_POST['dobDay']);
- $dobYear=cleanUp($_POST['dobYear']);
- $driversLicense=cleanUp($_POST['driversLicense']);
- $doYou=cleanUp($_POST['doYou']);
- $bodilyInjury=cleanUp($_POST['bodilyInjury']);
- $propertyDamage=cleanUp($_POST['propertyDamage']);
- $medicalPayments=cleanUp($_POST['medicalPayments']);
- $comprehensiveDeductible=cleanUp($_POST['comprehensiveDeductible']);
- $collisionDeductible=cleanUp($_POST['collisionDeductible']);
- $rentalReimbursement=cleanUp($_POST['rentalReimbursement']);
- $towing=cleanUp($_POST['towing']);
- $v1year=cleanUp($_POST['v1year']);
- $v1make=cleanUp($_POST['v1make']);
- $v1vin=cleanUp($_POST['v1vin']);
- $v2year=cleanUp($_POST['v2year']);
- $v2make=cleanUp($_POST['v2make']);
- $v2vin=cleanUp($_POST['v2vin']);
- $otherDrivers=cleanUp($_POST['otherDrivers']);
- $howMany=cleanUp($_POST['howMany']);
- $permission=cleanUp($_POST['permission']);
- $ssn=cleanUp($_POST['ssn']);
- if (!strlen($insuredName)) array_push($errorFields, 'insuredName');
- if (!strlen($email)) array_push($errorFields, 'email');
- if (!strlen($phone)) array_push($errorFields, 'phone');
- echo "got here step 2";
- #check for valid e-mail address
- if (!preg_match("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$^",$email)) {
- array_push($errorFields, 'email');
- die("Invalid Email Address. Email will not be sent");
- }
- #die if there are line returns in the name or e-mail field
- //if (!preg_match("\r",$insuredName) || !preg_match("\n",$insuredName) || !preg_match("\r",$email) || !preg_match("\n",$email)){
- //die("Why ?? :(");
- //}
- if (!count($errorFields)) {
- echo "no errors";
- #replace manual line returns in e-mail field
- $email = preg_replace("([\r\n])", "", $email);
- #prevent BCC
- $find = "[content-type|Content-Type|bcc:|cc:|viagra|levitra|pariscialis|angelfire|freewebpages|xxx|gay|sluts|incest|hardcore|anal]";
- #$find2 = "[http:]";
- if (preg_match($find, $insuredName) || preg_match($find, $email) || preg_match($find, $phone) || preg_match($find, $city) || preg_match($find, $state) || preg_match($find, $zip)) {
- print("<p>No meta/header injections, please. E-mail will not be sent.</p>");
- exit;
- }
- // call the swift mailer lib file
- require_once 'lib/swift_required.php';
- // create the swift mailer transport
- $transport = Swift_SMTPTransport::newInstance('172.16.4.18', 'ssl');
- // crate the Mailer using your created Transport
- $mailer = Swift_Mailer::newInstance($transport);
- $message->setSubject('Auto Insurance Quote Request form the Tracy-Driscoll web site');
- $message-> setFrom = '"' . stripslashes(checkit($_POST['insuredName'])) . '" <' . stripslashes(checkit($_POST['email'])) . '>';
- $message->setTo=(array('DPolletta@mbcinteractive.com' => 'Don Polletta', 'teresa.romano@nc.rr.com' => 'Teresa J Romano'));
- $message->setBody=(
- 'Received On: '.date('m/d/Y H:i:s').''
- 'Insured Information'
- 'Name: ' . stripslashes(checkit($_POST['$insuredName'])) .'
- 'Address: $address'
- 'City: $city'
- 'State: $state'
- 'Zip: $zip'
- 'Phone: $phone'
- 'Email: $email\n';
- 'Date of Birth: $dobMonth'/'$dobDay'/'$dobYear'
- 'Drivers License Number: $driversLicense'
- 'Current Insurance'
- 'Do you have Insurance: $do_you'
- 'Coverages';
- 'Bodily Injury Liability: $bodilyInjury'
- 'Property Damage Liability: $propertyDamage'
- 'Medical Payments: $medicalPayments'
- 'Comprehensive Deductible: $comprehensiveDeductible'
- 'Collision Deductible: $collisionDeductible'
- 'Rental Reimbursement: $rentalReimbursement'
- 'Towing & Labor: $towing'
- 'Vehicle 1 Information:'
- 'Year: $v1year'
- 'Make & Model: $v1make'
- ' VIN: $v1vin'
- 'Vehicle 2 Information:'
- ' Year: $v2year'
- ' Make & Model: $v2make'
- ' VIN: $v2vin'
- 'Licensed Drivers:'
- 'Any other Drivers: $otherDrivers'
- 'How Many?: $howMany'
- 'Credit Check'
- 'Permission: $permission'
- 'SSN: $ssn');
- $result = $mailer->send($message);
- // call the swift mailer lib file
- require_once 'lib/swift_required.php';
- // create the swift mailer transport
- $transport = Swift_SMTPTransport::newInstance('172.16.4.18', 'ssl');
- // crate the Mailer using your created Transport
- $mailer = Swift_Mailer::newInstance($transport);
- $message->setSubject('Auto Insurance Quote Request form the Tracy-Driscoll web site');
- $message-> setFrom = '"' . stripslashes(checkit($_POST['insuredName'])) . '" <' . stripslashes(checkit($_POST['email'])) . '>';
- $message->setTo=(array('DPolletta@mbcinteractive.com' => 'Don Polletta', 'teresa.romano@nc.rr.com' => 'Teresa J Romano', $email));
- $message->setBody=(
- 'Hello '.$_POST['$insuredName'].','
- 'Your quote request has been received! This email is a confirmation that we have received your request and is now being processed. You will be contacted by phone or email to discuss your Automobile Insurance Options.'
- 'For more exciting offers and news, please join our email list or become our fan on Facebook. Thank you for choosing Tracy-Driscoll for your Automobile Insurance Needs.'
- 'Thank you,'
- 'Tracy Driscoll'
- // send the message
- $result = $mailer->send($message);
- // Pass a variable name to the send() method
- if (!$mailer->send($message, $failures))
- {
- echo "Failures:";
- print_r($failures);
- }
- /*
- Failures:
- Array (
- 0 => receiver@bad-domain.org,
- 1 => other-receiver@bad-domain.org
- )
- */
- //header("Location: thankyou.php?n=".$insuredName."&date=");
- exit();
- }else{
- echo "you have errors!<br />";
- print_r($errorFields);
- }
- }else{
- // need to show the form here.. or just re-direct back to the form.
- header("Location: autoquote.html");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement