session_start();
session_register("CAPTCHA_session");
?>
ob_start();
?>
require("Lib/sqllib.inc"); ?>
require("Lib/urls.inc"); ?>
require("CAPTCHA.php"); ?>
$IsPageGood=true;
$GlobalMsg="";
$FailedFields="";
$firstname=($_POST["firstname"]);
$lastname=($_POST["lastname"]);
$centername=($_POST["centername"]);
$address1=($_POST["address1"]);
$address2=($_POST["address2"]);
$city=($_POST["city"]);
$state=($_POST["state"]);
$zip=($_POST["zip"]);
$phone=($_POST["phone"]);
$email=($_POST["email"]);
$hearaboutus=($_POST["hearaboutus"]);
$cameras=$_POST["cameras"];
$comments=$_POST["comments"];
$hidden_field=$_POST["captchabox"];
if ($_POST["RESET"]=="RESET")
{
$firstname="";
$lastname="";
$centername="";
$address1="";
$address2="";
$city="";
$state="";
$zip="";
$phone="";
$email="";
$hearaboutus="";
$comments="";
}
if ($_POST["DOIT"]=="SUBMIT ORDER")
{
CheckTheForm();
}
function IsBadData($infield)
{
extract($GLOBALS);
if ($IsPageGood==false)
{
$infield=$infield.",";
if ((strpos($FailedFields,$infield) ? strpos($FailedFields,$infield)+1 : 0)>0)
{
$function_ret="";
}
}
return $function_ret;
}
function MyEmpty($instring)
{
extract($GLOBALS);
if ($_POST[$instring]=='' || strlen(trim($_POST[$instring]))==0)
{
$function_ret=true;
}
else
{
$function_ret=false;
}
return $function_ret;
}
function CheckTheForm()
{
extract($GLOBALS);
if (MyEmpty("hearaboutus"))
{
$GlobalMsg="Please tell us how you heard about us.";
$FailedFields=$FailedFields."hearaboutus,";
$IsPageGood=false;
}
if (MyEmpty("email"))
{
$GlobalMsg="Please enter your Email address.";
$FailedFields=$FailedFields."email,";
$IsPageGood=false;
}
if (MyEmpty("phone"))
{
$GlobalMsg="Please enter your phone number.";
$FailedFields=$FailedFields."phone,";
$IsPageGood=false;
}
if (MyEmpty("zip"))
{
$GlobalMsg="Please enter your zip code.";
$FailedFields=$FailedFields."zip,";
$IsPageGood=false;
}
if (MyEmpty("state"))
{
$GlobalMsg="Please enter your state.";
$FailedFields=$FailedFields."state,";
$IsPageGood=false;
}
if (MyEmpty("city"))
{
$GlobalMsg="Please enter your city.";
$FailedFields=$FailedFields."city,";
$IsPageGood=false;
}
if (MyEmpty("address1"))
{
$GlobalMsg="Please enter your address.";
$FailedFields=$FailedFields."address1,";
$IsPageGood=false;
}
if (MyEmpty("centername"))
{
$GlobalMsg="Please enter the name of your center.";
$FailedFields=$FailedFields."centername,";
$IsPageGood=false;
}
if (MyEmpty("lastname"))
{
$GlobalMsg="Please enter your last name.";
$FailedFields=$FailedFields."lastname,";
$IsPageGood=false;
}
if (MyEmpty("firstname"))
{
$GlobalMsg="Please enter your first name.";
$FailedFields=$FailedFields."firstname,";
$IsPageGood=false;
}
if (strlen($hidden_field)>0)
{
if (strtoupper($hidden_field)==strtoupper($_SESSION['CAPTCHA']))
{
$GlobalMsg="Verified OK";
}
else
{
$GlobalMsg="Please enter the correct characters for the validation field.";
$IsPageGood=false;
}
}
else
{
$IsPageGood=false;
$GlobalMsg="Please be sure to answer the verification question!";
}
if ($IsPageGood==true)
{
Send_Email();
}
return $function_ret;
}
//----- This is for submitting request to a database table. This has been temporarily replaced with the send email function below! ------
/*
function Submit_to_DB()
{
}
*/
function Send_Email()
{
extract($GLOBALS);
$msg=("This daycare center is requesting more information!:"."\r\n"."\r\n".
$centername."\r\n"."\r\n".
"Name: ".$firstname." ".$lastname."\r\n"."\r\n".
"Address: ".$address1."\r\n".
"City, State, Zip: ".$city.", ".$state." ".$zip."\r\n"."\r\n".
"Phone Number: ".$phone."\r\n"."\r\n".
"Email: ".$email."\r\n"."\r\n".
"Number of cameras:".$cameras."\r\n".
"Heard About Us: ".$centername."\r\n"."\r\n".
"Additional Commetns: "."\r\n".$comments."\r\n"."\r\n".
"Please get in contact with them.");
// $mail is of type "Persits.MailSender"
$mail->Host="mail.nutech.com";
$mail->From="postmaster@nutech.com";
$mail->FromName=$firstname." ".$lastname;
//mail.AddAddress("scott@nutech.com")
//mail.AddAddress("center-request@parent-view.com")
$mail->AddAddress("sales@nutech.com");
$mail->AddBCC("mathewss@corp.nutech.com");
$mail->isHtml=$isHtml;
$mail->Subject="Child Care Center Request Form";
$mail->Body=$msg;
$mail->Send();
$mail=null;
header("Location: "."thankyou.php");
return $function_ret;
}
?>