Your Feedback
//error_reporting(9);
if(isset($_POST['api_co'])){
$api_co = $_POST['api_co'];
$referrer = $_POST['referrer'];
$customer = $_POST['customer'];
$name = $_POST['name'];
$title = $_POST['title'];
$company = $_POST['company'];
$address = $_POST['address'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$email = $_POST['email'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$phone = $_POST['phone'];
$fax = $_POST['fax'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$result = $_POST['result'];
$result2 = $_POST['result2'];
$result3 = $_POST['result3'];
$string = "$name $title $company $address $address2 $city $email $zip $country $phone $fax $email $comments";
function words($string,$seperator=":") {
global $result;
$array = explode($seperator, $string);
$result = count($array);
}
words($string,$seperator=":");
$string = "$name $title $company $city $email $zip $country $phone $fax $email";
function words2($string,$seperator="\r") {
global $result2;
$array = explode($seperator, $string);
$result2 = count($array);
}
words2($string,$seperator="\r");
$string = "$name $title $company $city $email $zip $country $phone $fax $email";
function words3($string,$seperator="\n") {
global $result3;
$array = explode($seperator, $string);
$result3 = count($array);
}
words3($string,$seperator="\n");
if ($result > 1 || $result2 > 1 || $result3 > 1 || $result4 > 1) {
$spoof = "1";
}
if ($referrer == "Please Select" || $customer == "Please Select") {
$spoof = "1";
}
$stopwords = array("bcc:", "cc:", "CC:", "Bcc:", "BCC:", "BCc:", "BcC:", "Subject:", "subject:", "SUBJECT:", "From:", "from:", "FROM:", "To:", "TO:", "to:", "Content-Type:", "content-type:", "CONTENT-TYPE:");
$fields = array("name", "title", "company", "address", "address2", "city", "zip", "country", "phone", "fax", "email", "comments");
for($a = 0; $a < count($fields); $a++) {
$$fields[$a] = str_replace($stopwords, "", $$fields[$a]);
}
$connection = mysql_connect("localhost","root", "connect");
$db = mysql_select_db("inquiry", $connection);
$sql = "SELECT * FROM `mailto` where `co` =\"".$api_co."\"";
$sql_result = mysql_query($sql, $connection);
$row = mysql_fetch_array($sql_result);
$id = $row["id"];
$co = $row["co"];
$website = $row["website"];
$mailto = $row["mailto"];
/* Added to put the customer name in the From field 20100223 RCOLEMAN */
$contact = ($name != "") ? $name : $customer;
$mailsubject = $api_co." - Feedback";
$mailheaders = "From: ".$contact." <".$email.">\r\n" .
"BCC: webmaster@apigroupinc.us";
$mailbody = "
Referrer: $referrer
Customer: $customer
Name: $name
Title: $title
Company: $company
Address: $address
Address Line2: $address2
City: $city
State: $state
Zip: $zip
Country: $country
Phone: $phone
FAX: $fax
E-mail: $email
*****************************************************
Comments:
$comments";
if ($email != "" && $name != $email && $name != "" && $spoof != "1"){
if(mail($mailto, $mailsubject, $mailbody, $mailheaders)){
$mailto2 = "webmaster@apigroupinc.us";
mail($mailto2, $mailsubject, $mailbody, $mailheaders);
$today = date("Y-m-d");
$connection_insert = mysql_connect("localhost","root", "connect") or die("ConnectFailed");
$db_insert = mysql_select_db("inquiry", $connection_insert);
$sql_insert = "INSERT INTO `inquiry` (`api_co`, `today`, `referrer`, `customer`, `name`, `title`, `company`, `phone`, `fax`, `address`, `address2`, `city`, `state`, `zip`, `country`, `email`, `comments`) VALUES (\"".$api_co."\",\"".$today."\",\"".$referrer."\",\"".$customer."\",\"".$name."\",\"".$title."\",\"".$company."\",\"".$phone."\",\"".$fax."\",\"".$address."\",\"".$address2."\",\"".$city."\",\"".$state."\",\"".$zip."\",\"".$country."\",\"".$email."\",\"".$comments."\")";
$sql_result_insert = mysql_query($sql_insert, $connection_insert);
/* THANK YOU */
$mailsubject = "$api_co";
$mailheaders = "MIME-Version: 1.0\r\n";
$mailheaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mailheaders .= "From: inquiry@apigroupinc.us";
$mailbody = "
|
Dear ".$name.",
Thank you for contacting ".$api_co."
This is an automatic response so please do not reply. We will contact you shortly.
$website
|
|
|
|
";
mail($email, $mailsubject, $mailbody, $mailheaders);
/* END THANK YOU */
}
}
print("
Thank you for your submission, your comments were sent to $api_co Please wait...
");
exit();
}
include_once '/var/www/html/internet/apigroupinc/contact-us2.php';
js();
?>