contact
Rabbi Shlomo Crandall
Regional Director
Chai Lifeline Midwest
6600 North Lincoln Ave
Suite 300
Lincolnwood, IL 60712
Phone: (847) 763-1818
Fax: (847) 763-1820
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 ((function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc())) {
$comments = stripslashes( $comments );
}
$comments=str_replace ("'", "", $comments);
$comments=str_replace ('"', '', $comments);
if($_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 = $_SERVER['REMOTE_ADDR'];
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')){
if($InsertDB == 1) {
$newid = insert($name,$phone,$liame,$comments,$category,$http_referrer,$ip);
}
sendEMail($emailto,$subject,$name,$phone,$liame,$comments,$category,$http_referrer,$ip,$newid);
message('Thank you for contacting us.
A representative will get
back to you shortly.');
}else{
echo '
There was an error submitting this form. Please contact our office. (TT-'.$totaltime.')
';
}
break;
default :
showFrm();
}
function showFrm()
{
?>
}
function insert($name,$phone,$liame,$comments,$category,$http_referrer,$ip)
{
global $database_chai,$chai,$sql;
$Comments=addslashes($Comments);
$sql = "INSERT INTO `contact` (date,Name,Phone,Email,Comment,Category,http_referrer,ip)
VALUES (NOW(),'$name','$phone','$liame','$comments','$category','$http_referrer','$ip')";
//message ($sql);
mysql_select_db($database_chai, $chai);
$id = mysql_query($sql);
$id = mysql_insert_id();
return $id;
}
function sendEmail($emailto,$subject,$name,$phone,$liame,$comments,$category,$http_referrer,$ip,$newid)
{
$comments = stripslashes( $comments );
if($InsertDB == 1) {
$newid = ' Reference # '.$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 from: '.$http_referrer.' '.$newid.' IP:'.$ip.'
';
// echo $email_message;
mail($emailto, $subject, $email_message, "From: $name <$liame>");
return;
}
function message($message)
{
echo "
$message
";
}
?>