session_start();
if (isset($_POST['submit'])){
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$Phone = $_POST['Phone'];
$Email = $_POST['Email'];
$Address = $_POST['Address'];
$Address = str_replace ('"',' ',$Address);
$Address = str_replace ("'","",$Address);
$Address = str_replace (","," ",$Address);
$City = $_POST['City'];
$ZipCode = $_POST['ZipCode'];
$Age = $_POST['Age'];
$ReadyToBuy = $_POST['ReadyToBuy'];
$CarMake = $_POST['CarMake'];
$CarModel = $_POST['CarModel'];
$NewUsed = $_POST['NewUsed'];
$Budget = $_POST['Budget'];
$Budget = str_replace (",","",$Budget);
$Budget = str_replace (".00","",$Budget);
$Contact = $_POST['Contact'];
$ContactType= $_POST['ContactType'];
$BestTime= $_POST['BestTime'];
$Comments = $_POST['Comments'];
$Comments = str_replace ('"',' ',$Comments);
$Comments = str_replace ("'","",$Comments);
$Comments = str_replace ("/"," ",$Comments);
$Comments = str_replace (","," ",$Comments);
$Comments = str_replace (";"," ",$Comments);
if ($Comments == '')
{
$Comments = "None";
}
////////////////// Change Per Site ///////////
include ('IDIPs.php');
$memip = $_SERVER['REMOTE_ADDR'];
$date = date("Y-m-d");
if (check_email_address($Email)) { // vadidate email
//echo $Email . ' is a valid email address.';
$EmailIsOk = "True";
} else {
//echo $Email . ' is not a valid email address.';
$EmailIsOk = "False";
$Flag = "ON";
}
$str1 = trim($FirstName); // trim each
$str2 = trim($LastName);
if (strlen($str1) == 1 AND strlen($str2) == 1) //see if length = 1
{
$Flag = "ON";
}
if ($str1 == "1" AND $str2 == "1") //see if the string is = to "1"
{
$Flag = "ON";
}
$pos = strpos($FirstName, "http"); //find specific characters in a string
$pos2 = strpos($FirstName, "@");
if ($pos === false or $pos2 === false) {
//echo "The string was not found in the string";
} else {
//echo "The string was found in the string";
$Flag = "ON";
}
$pos3 = strpos($LastName, "http"); //find specific characters in a string
$pos4 = strpos($LastName, "@");
if ($pos3 === false or $pos4 === false) {
//echo "The string was not found in the string";
} else {
//echo "The string was found in the string";
$Flag = "ON";
}
if($Flag != "ON") {
////////////////// Change Per Site ///////////
include('CANServerSettings.php');
$tbl_name = "ContactCANInquiry";
$con=mysqli_connect("$host","$username","$password","$db_name");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO $tbl_name (date,Business,FirstName,LastName,Email,Phone,Comments)
VALUES ('$date','$Business','$FirstName', '$LastName', '$Email','$Phone', '$Comments')";
if (!mysqli_query($con,$sql))
{
//echo "could not insert into database";
die('Error: ' . mysqli_error($con));
}
//echo "1 record added";
send_email_Contact($Perks,$Flag,$FirstName,$LastName,$CarMake,$CarModel,$Comments,$Email,$Phone,$ZipCode,$Address,$City,$Age,$ReadyToBuy,$NewUsed,$Budget,$Contact,$ContactType,$BestTime,$ContactEmail,$TXTMessagePhone);
$final_report ="Thank you. Your email has been sent";
mysqli_close();
} // End Flag
if($Flag == "ON") {
$final_report ="Attention: Some Part Of Your Data Is Incorrect. Please ReSubmit.";
}
} // End KeyPress
?>
include('BootStrapSetups.php'); ?>
$CC= 0;
$BackGrndColor1 = "#FFFFFF";
$BackGrndColor2 = "#F0F1F1";
$bkclass = ($CC%2 == 0)? $BackGrndColor1: $BackGrndColor2;
?>
Never Visit The Dealership Again
AutoExpress2U Auto Buying Response Card
$CC = $CC + 1;
$bkclass = ($CC%2 == 0)? $BackGrndColor1: $BackGrndColor2;
?>
NO HAGGLE HOME OR OFFICE DELIVERY
Please Complete The Email Request To Contact Us
function check_email_address($Email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $Email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $Email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
?>
function send_email_Contact($Perks,$Flag,$FirstName,$LastName,$CarMake,$CarModel,$Comments,$Email,$Phone,$ZipCode,$Address,$City,$Age,$ReadyToBuy,$NewUsed,$Budget,$Contact,$ContactType,$BestTime,$ContactEmail,$TXTMessagePhone) {
$headers = "From: ". $Email . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf8' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();
$headers .= "X-Priority: 1 \n";
$headers .= "Importance: High \n";
include('PerksPromo.php');
include('ContactInfo.php');
/*
if($TXTMessagePhone > '' AND $Flag != 'ON')
{
$sms = "$Perks Inquiry For $CarMake Dealer";
$Subject4 = "Member Contact Injuiry For $CarMake Dealer";
$headers4 = "From: ". $Email . "\r\n";
$headers4 .= "X-Priority: 1 \n";
$headers4 .= "Importance: High \n";
}
*/
$BobPhotoLink = $MyAutoPerksSMLogoURL;
$CMLLCPhotoLink = $MyAutoPerksSMLogoURL;
if($Email > '' AND $Flag != 'ON')
{
$to = $ContactEmail;
//$to = "bcarguy1@gmail.com";
$Subject = "$Perks Member Inquiry Requesting $CarMake Dealer";
$Message = '' ;
//$Message .= "$JobName, A Client, $FirstName, Has Reviewed Your Video Resume And Requests A Video Chat via Dealership. Their Dealership Username is $Dealership.
";
$Message .= "$Perks Member Inquiry Requesting $CarMake Dealer
";
$Message .= "Please contact $FirstName $LastName
";
$Message .= "Email: $Email
";
$Message .= "Phone: $Phone
";
$Message .= "CarMake: $CarMake
";
if($CarModel > '') {
$Message .= "CarModel: $CarModel
";
}
//$Message .= "Partner: $NetWorkPartner
";
$Message .= "Address: $Address
";
$Message .= "City: $City
";
$Message .= "ZipCode: $ZipCode
";
$Message .= "Age: $Age
";
$Message .= "Ready To Buy: $ReadyToBuy
";
$Message .= "NewUsed: $NewUsed
";
$Message .= "Budget: $Budget
";
$Message .= "Can We Contact: $Contact
";
$Message .= "Contact By: $ContactType
";
$Message .= "Best Time: $BestTime
";
$Message .= "Comments: $Comments
";
$Message .= "Thank you,
";
//$Message .= '
';
$Message .= "$Perks Team
";
//$Message .= '
';
$Message .= '';
$send = mail($to, $Subject, $Message, $headers);
//if($TXTMessagePhone > '' AND $Flag != 'ON')
//{
//$send2 = mail($TXTMessagePhone,$Subject4,$sms,$headers4);
//}
//Send To Customer
$Subject2 = "The $Perks Team Has Been Contacted";
$headers2 = "From: ". $ContactEmail . "\r\n";
$headers2 .= 'MIME-Version: 1.0' . "\r\n";
$headers2 .= 'Content-type: text/html; charset=utf8' . "\r\n";
$headers2 .= 'X-Mailer: PHP/' . phpversion();
$headers2 .= "X-Priority: 1 \n";
$headers2 .= "Importance: High \n";
$Sendto = $Email;
$Message2 = '';
$Message2 .= "$FirstName, Your Request Has Been Sent To Our Team And We Will Contact You Promptly With A Preferred $CarMake Dealer
";
$Message2 .= "Thank you,
";
//$Message2 .= '
';
$Message2 .= "$Perks Team
";
//$Message2 .= '
';
$Message2 .= '';
$send2 = mail($Sendto, $Subject2, $Message2, $headers2);
//echo "$FirstName, Your Request Has Been Sent To Our Sales Team. Thank You.";
}
return;
}
?>