Pre-Sale Contact Information
Online: www.ohrnaava.com
Mail: 2201 East 23rd Street
Brooklyn, NY 11229
Fax: (718) 228-2823
Phone: (718) 360-1715
if (!isset($_POST['action'])) {
$action="none";
} ELSE {
$action=$_POST['action'];
}
if (isset($_POST['name'])) {
$name=mysql_escape_string($_POST['name']);
}
if (isset($_POST['liame'])) {
$liame=mysql_escape_string($_POST['liame']);
}
if (isset($_POST['phone'])) {
$phone=mysql_escape_string($_POST['phone']);
}
if (isset($_POST['zip'])) {
$zip=mysql_escape_string($_POST['zip']);
}
if (isset($_POST['comments'])) {
$comments=mysql_escape_string($_POST['comments']);
}
if (isset($_POST['category'])) {
$category=mysql_escape_string($_POST['category']);
}
//if (get_magic_quotes_gpc()) {
// $comments = stripslashes( $comments );
//}
//$comments=str_replace ("'", "", $comments);
//$comments=str_replace ('"', '', $comments);
if(isset($_POST['starttime']) && $_POST['starttime']){
$starttime=$_POST['starttime'];
$endtime = microtime();
$endarray = explode(" ", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = $endtime - $starttime;
$totaltime = round($totaltime,5);
//echo "Total time: $totaltime";
}
$http_referrer = getenv( "HTTP_REFERER" );
$ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$http_agent = getenv ("HTTP_USER_AGENT");
$curDate = date("l, F j, Y, g:i a") ;
switch($action){
case 'insert':
if (eregi('http', $comments)) {
die ('
Sorry, we do not allow urls in the comment field.
Please go back to correct it.');
}
if(((($liame) && strstr($liame,"@") && strstr($liame,"."))||($RequireEmail=='0')) && ($totaltime>='2')&&(($RequireSession != 1)||(!isset($_SESSION['check']))||($_SESSION['check'] >= 1))){
if($InsertDB == 1) {
$newid = insert($ContactTable,$name,$phone,$liame,$comments,$category,$http_referrer,$ip,$http_agent);
}
sendEMail($emailto,$sitename,$subject,$CustomerEmail,$CustomerSubject,$CustomerMessage,$name,$phone,$liame,$comments,$category,$http_referrer,$ip,$http_agent,$curDate,$newid,$totaltime);
message('
Thank you for contacting us.
A representative will get back to you shortly.');
$_SESSION['check'] = 0;
}else{
echo '
There was an error submitting this form. Please contact our office. (Error code: TT-'.$totaltime.'-'.$_SESSION['check'].')
';
}
break;
default :
showFrm();
}
function showFrm()
{
?>
}
function insert($ContactTable,$name,$phone,$liame,$comments,$category,$http_referrer,$ip,$http_agent)
{
global $database_main,$main,$sql;
$comments=addslashes($comments);
$sql = "INSERT INTO `$ContactTable` (date,name,phone,liame,comments,category,http_referrer,ip,http_agent)
VALUES (NOW(),'$name','$phone','$liame','$comments','$category','$http_referrer','$ip','$http_agent')";
//message ($sql);
mysql_select_db($database_main, $main);
$id = mysql_query($sql);
$id = mysql_insert_id();
return $id;
}
function sendEmail($emailto,$sitename,$subject,$CustomerEmail,$CustomerSubject,$CustomerMessage,$name,$phone,$liame,$comments,$category,$http_referrer,$ip,$http_agent,$curDate,$newid,$totaltime)
{
//$Comment=addslashes($Comment);
$comments = str_replace('\r', '
', $comments);
$comments = str_replace('\n', '
', $comments);
$comments = stripslashes( $comments );
if(($newid)&&($newid != '')) {
$newid = ' Reference # '.$newid;
}
else { $newid = '';
}
$email_message = 'The following contact form has just been submitted from your site.
From: '.$name.'
Phone: '.$phone.'
Email: '.$liame.'
Comments: '.$comments.'
This message was sent at '.$curDate.' from: '.$http_referrer.' '.$newid.' IP:'.$ip.' '.$http_agent.' ('.$totaltime.')
';
// echo $email_message;
$SentSuccess = mail($emailto, $subject, $email_message, "From: $name <$liame>");
if($CustomerEmail == 1) {
mail($liame, $CustomerSubject, $CustomerMessage, "From: $sitename <$emailto>");
}
if(!$SentSuccess) { die('
There was an error emailing this form. Please contact our office.
'); }
return;
}
function message($message)
{
echo "
$message
";
// Don't allow to refresh page
// $curLocation = $_SERVER['PHP_SELF'].'?action= ';
// header( "Location: $curLocation" );
}
?>