Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php session_start();
- $con = mysql_connect("172.16.4.23","reportswo","writeonly");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- $date = date('Y-m-d');
- $quote_type = $_POST["auto"];
- echo "you got here";
- mysql_select_db("reports", $con);
- $sql="INSERT INTO tracydriscoll (date, contactName, address, city, state, zip, email, quote_type)
- VALUES
- ('$_POST[date]','$_POST[contactName]','$_POST[address]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[email]','$_POST[quote_type]')";
- if (!mysql_query($sql,$con))
- {
- die('Error: ' . mysql_error());
- }
- echo "1 record added";
- mysql_close($con);
- ini_set('display_errors', 'On');
- error_reporting(E_ALL);
- /* *********** FUNCTIONS ****************** */
- function checkit($contactName) {
- return(str_replace(array("\r", "\n", "%OA", "%oa", "%OD", "%od", "Content-Type:","BCC:","bcc:"), "", $contactName));
- }
- 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 />";
- $contactName =cleanUp($_POST['contactName']);
- $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($contactName)) array_push($errorFields, 'contactName');
- 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",$contactName) || !preg_match("\n",$contactName) || !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, $contactName) || 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;
- }
- /* *********** First email to Don, Teresa and TD ****************** */
- require_once('class.phpmailer.php');
- include_once("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
- $mail = new PHPMailer(); // the true param means it will throw exceptions on errors, which we need to catch
- $mail->IsSMTP(); // telling the class to use SMTP
- try{
- $mail->Host = "172.16.4.18"; // SMTP server
- $mail->Port = 25;
- $mail->SMTPAuth = true;
- $mail->Username = "tracy1@oldgate.org"; // SMTP account username
- $mail->Password = "driscoll2";
- $mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
- $mail->AddReplyTo(stripslashes(checkit($_POST['email'])), stripslashes(checkit($_POST['contactName'])));
- //$mail->AddAddress('bkdehm@tracy-driscoll.com' , 'Brian Dehm');
- //$mail->AddAddress('DPolletta@mbcinteractive.com' , 'Don Polletta');
- $mail->AddAddress('teresa.romano@nc.rr.com' , 'Teresa Romano');
- $mail->SetFrom(stripslashes(checkit($_POST['email'])), stripslashes(checkit($_POST['contactName'])));
- $mail->Subject = 'Auto Insurance Quote Request from the Tracy-Driscoll web site';
- $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
- $mail->msgHTML(
- 'Received On: '.date('m/d/Y H:i:s').'<br/><br/>
- <h3>Insured Information</h3><br/>'.
- 'Name: ' . stripslashes(checkit($contactName)) . '<br/>'.
- 'Address: '.$address.'<br/>'.
- 'City: '.$city.'<br/>'.
- 'State: '.$state.'<br/>'.
- 'Zip: '.$zip.'<br/>'.
- 'Phone: '.$phone.'<br/>'.
- 'Email: '.$email.'<br/>'.
- 'Date of Birth: '.$dobMonth.' '.$dobDay.','.$dobYear.'<br/>'.
- 'Drivers License Number: '.$driversLicense.'<br/>'.
- '<h3>Current Insurance</h3><br/>'.
- 'Do you have Insurance: '.$do_you.'<br/><br/>'.
- '<h3>Coverages</h3><br/>'.
- 'Bodily Injury Liability: '.$bodilyInjury.'<br/>'.
- 'Property Damage Liability: '.$propertyDamage.'<br/>'.
- 'Medical Payments: '.$medicalPayments.'<br/>'.
- 'Comprehensive Deductible: '.$comprehensiveDeductible.'<br/>'.
- 'Collision Deductible: '.$collisionDeductible.'<br/>'.
- 'Rental Reimbursement: '.$rentalReimbursement.'<br/>'.
- 'Towing & Labor: '.$towing.'<br/><br/>'.
- '<h3>Vehicle 1 Information:</h3><br/>'.
- 'Year: '.$v1year.'<br/>'.
- 'Make & Model: '.$v1make.'<br/>'.
- 'VIN: '.$v1vin.'<br/><br/>'.
- '<h3>Vehicle 2 Information:</h3><br/>'.
- 'Year: '.$v2year.'<br/>'.
- 'Make & Model: '.$v2make.'<br/>'.
- 'VIN: '.$v2vin.'<br/><br/>'.
- '<h3>Licensed Drivers:</h3><br/>'.
- 'Any other Drivers: '.$otherDrivers.'<br/>'.
- 'How Many?: '.$howMany.'<br/><br/>'.
- '<h3>Credit Check</h3><br/>'.
- 'Permission: '.$permission.'<br/>'.
- 'SSN: '.$ssn);
- $mail->Send();
- echo "Message Sent OK</p><br/>";
- } catch (phpmailerException $e) {
- echo $e->errorMessage(); //Pretty error messages from PHPMailer
- } catch (Exception $e) {
- echo $e->getMessage(); //Boring error messages from anything else!
- }
- /* *********** Second email to customer ****************** */
- require_once('class.phpmailer.php');
- include_once("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
- $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
- $mail->IsSMTP(); // telling the class to use SMTP
- try {
- $mail->Host = "172.16.4.18"; // SMTP server
- $mail->Port = 25;
- $mail->SMTPAuth = true;
- $mail->Username = "tracy1@oldgate.org"; // SMTP account username
- $mail->Password = "driscoll2";
- $mail->SMTPDebug = 0; // enables SMTP debug information (for testing);
- $mail->AddReplyTo('webserver@tracy-driscoll.com', 'Online Quote');
- $mail->AddAddress('teresa.romano@nc.rr.com' , 'Teresa Romano');
- $mail->AddAddress(stripslashes(checkit($_POST['email'])), stripslashes(checkit($_POST['contactName'])));
- $mail->SetFrom('webserver@tracy-driscoll.com', 'Online Quote');
- $mail->Subject = 'Auto Insurance Quote Request from the Tracy-Driscoll web site';
- $mail->msgHTML(
- 'Hello '.$contactName.',<br/><br/>
- 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 insurance options with a Tracy-Driscoll agent shortly.<br/><br/>'.
- 'No matter what type of service you are in search of, there are certain things you probably look for when choosing a company to do business with: quality work, exceptional products, friendly assistance, prompt attention, fair pricing... <br/><br/>'.
- 'When you are looking for someone to meet your insurance coverage needs, Tracy-Driscoll Insurance & Financial Services provides all this and more. We will carefully analyze your needs and recommend the right plan to make sure you are adequately protected, at the most reasonable rates. <br/><br/>'.
- 'Whether you are in need of auto, homeowners, health, life or business coverage, trust Tracy-Driscoll, supporting our community for 90 years. <br/><br/>'.
- 'Call us today to speak with an insurance specialist (860) 589-3434, or visit us online at www.Tracy-Driscoll.com. <br/><br/>'.
- 'Sincerely,<br/>'.
- 'Brian K. Dehm, President ');
- $mail->Send();
- echo "Message Sent OK</p>\n";
- } catch (phpmailerException $e) {
- echo $e->errorMessage(); //Pretty error messages from PHPMailer
- } catch (Exception $e) {
- echo $e->getMessage(); //Boring error messages from anything else!
- }
- header("Location: http://www.tracydriscoll.com/landingpages/auto/thanks.html");
- }else{ // else for errors..
- echo "you have errors!<br />";
- print_r($errorFields);
- }
- }else{
- header("Location: https://www.tracy-driscoll.com/forms/auto_quote.php");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement