echo $fax?> |
echo $contact_text?> |
include("init.php");
$_SESSION['active_sec'] = "contact";
$active_sec = $_SESSION['active_sec'];
$sec_id = 13;
//===========================================
//GET CONTACT INFO
//===========================================
$query6 = "SELECT * FROM ".$SiteV."Company";
$result6 = @mysql_query($query6);
$row6 = mysql_fetch_array($result6, MYSQL_BOTH);
$phone = $row6['Phone'];
$fax = $row6['Fax'];
$contact_text = $row6['Description'];
//$contact_text = ereg_replace("
", "\n", $contact_text);
$email = $row6['Email'];
$email_vis = $row6['EmailVis'];
$form_vis = $row6['FormVis'];
$news_vis = $row6['NewsVis'];
$fields_array = array();
for ($i=1; $i<=$ContactFields; $i++){
$fields_array[$i] = array(
"name" => $row6["Field".$i],
"required" => $row6["Field".$i."r"],
"visible" => $row6["Field".$i."v"]
);
}
//==============================
//GET MAIN SECTION INFO
$query7 = "SELECT * FROM ".$SiteV."MenuM WHERE SecID = '$sec_id'";
$result7 = @mysql_query($query7);
$row7 = mysql_fetch_array($result7, MYSQL_ASSOC);
$title =$row7['Section'];
$title2 =$row7['Section2'];
//get SMTP settings
$query1 = "SELECT * FROM ".$SiteV."Contact";
$result1 = mysql_query($query1);
$row1 = mysql_fetch_array($result1, MYSQL_BOTH);
extract($row1);
//$text_w = $fr_w - 40 - $img_w;
//==================================
//PROCESS FORM
$error_txt = "fields marked with * are required";
$error_msg = $error_txt;
$error_msg2 = "";
if (isset($_POST['sent'])){
//set subject
$subject_exists = false;
for ($i = 1; $i <= $ContactFields; $i++){
if (isset($_POST['f'.$i]) && (substr_count($_POST['f'.$i], "Subject") > 0 || substr_count($_POST['f'.$i], "subject") > 0 || substr_count($_POST['f'.$i], "SUBJECT") > 0)){ //form has subject field
$subject = urldecode($_POST['f'.$i]);
$subject_exists = true;
}
}
if (!$subject_exists){
$subject = "New client inquiry.";
}
//set body
$body = "";
for ($i=1; $i<=$ContactFields; $i++){
if ($fields_array[$i]['visible'] == "yes"){
if (($_POST['f'.$i] == "" || $_POST['f'.$i] == $fields_array[$i]['name']) && $fields_array[$i]['required'] == "yes"){
$error_msg = "please fill out ".$fields_array[$i]['name'];
break;
}
$body .= $fields_array[$i]['name'].": ".urldecode($_POST['f'.$i])."\n\n";;
}
}
if ($error_msg == $error_txt){
//set from header
$email_exists = false;
for ($i = 1; $i <= $ContactFields; $i++){
if (isset($_POST['f'.$i]) &&
(substr_count(strtolower($fields_array[$i]['name']), "e-mail") > 0 ||
substr_count(strtolower($fields_array[$i]['name']), "email") > 0
)){ //form has email field
$cEmail = $_POST['f'.$i];
$email_exists = true;
}
//echo $_POST['f'.$i]."
";
}
if (!$email_exists){
$cEmail = $email;
//echo "test fail";
}
$from = "From: ".$cEmail;
//send email
/*if (mail($email, $subject, $body, $from)){
$error_msg = "message has been sent.";
} else {
$error_msg = "message could not be sent. please contact your administrator.";
}*/
//send e-mail
if ($Mailer == "mail" || $Mailer == ""){
$header = "From: $cEmail\n";
$header .= "Content-Type: text/plain; charset=utf-8\n";
if (mail($email, $subject, $body, $header)){
$error_msg ='Thank You! Your message has been successfully sent.';
} else {
$error_msg ='The message could not be sent. Please click on the e-mail address to send message.';
}
} else if ($Mailer == "smtp"){
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->Mailer = $Mailer; // telling the class to use SMTP
$mail->SMTPAuth = $SMTPAuth; // SMTP authorization
if ($Secure == "yes"){
$mail->Host = "ssl://".$Host; // SMTP server
} else {
$mail->Host = $Host; // SMTP server
}
$mail->Username = $Username;
$mail->Password = $Password;
$mail->Port = $Port;
$mail->From = $cEmail;
$mail->FromName = $cEmail;
$mail->AddAddress($coEmail);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->WordWrap = $WordWrap;
if(!$mail->Send()) {
$error_msg = $mail->ErrorInfo;
} else {
$error_msg ="Thank You! Your message has been successfully sent.";
}
}
//====================================================
//SEND CONFIRMATION
//get confirmation email details
$query = "SELECT FormSubject, FormMessage, Confirmation FROM ".$SiteV."Company";
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_BOTH);
extract($row);
if ($Confirmation == "yes"){
if ($Mailer == "mail" || $Mailer == ""){
$header = "From: $email\n";
$header .= "Content-Type: text/html; charset=iso-8859-1\n";
mail($cEmail, $FormSubject, $FormMessage, $header);
} else if ($Mailer == "smtp"){
$mail2 = new PHPMailer();
$mail2->Mailer = $Mailer; // telling the class to use SMTP
$mail2->SMTPAuth = $SMTPAuth; // SMTP authorization
if ($Secure == "yes"){
$mail2->Host = "ssl://".$Host; // SMTP server
} else {
$mail2->Host = $Host; // SMTP server
}
$mail2->Username = $Username;
$mail2->Password = $Password;
$mail2->Port = $Port;
$mail2->From = $coEmail;
$mail2->FromName = $coEmail;
$mail2->AddAddress($cEmail);
$mail2->Subject = $FormSubject;
$mail2->Body = $FormMessage;
$mail2->WordWrap = $WordWrap;
$mail2->Send();
}
}
}
}
$news_msg = "";
if (isset($_POST['subscribed'])){
$news_email = trim($_POST['news_email']);
if ($news_email != ""){
$query1 = "select Email from ".$SiteV."MailingList where Email = '$news_email'";
$result1 = mysql_query($query1);
if (mysql_num_rows($result1) <= 0){
$query = "insert into ".$SiteV."MailingList (Email) values ('$news_email')";
$result = mysql_query($query);
$news_msg = "The e-mail has been submitted.";
} else {
$news_msg = "This e-mail address is already subscribed.";
}
} else {
$news_msg = "Please enter an e-mail address.";
}
}
$onload = "updateOrientation();";
$img_count = 0;
include("header.php");
?>
echo $fax?> |
echo $contact_text?> |