session_start();
session_register("CAPTCHA_session");
?>
require("Lib/sqllib.inc"); ?>
require("Lib/urls.inc"); ?>
require("Lib/login.inc"); ?>
require("CAPTCHA.php"); ?>
$IsPageGood=true;
$GlobalMsg="";
$FailedFields="";
$IsUserGood=false;
$fullname=($_POST["fullname"]);
$centername=($_POST["centername"]);
$address=($_POST["address"]);
$citystatezip=($_POST["citystatezip"]);
$centerphone=($_POST["centerphone"]);
$email=($_POST["email"]);
$hearaboutus=($_POST["hearaboutus"]);
$comments=($_POST["comments"]);
$captcha=$_POST["captchabox"];
if ($_POST["reset"]=="RESET")
{
$fullname="";
$centername="";
$address="";
$citystatezip="";
$hearaboutus="";
$centerphone="";
$email="";
$comments="";
}
if ($_POST["send referral"]=="SEND MY REFERRAL")
{
CheckTheForm();
}
function IsBadData1($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("email"))
{
$GlobalMsg="Please enter your Email address.";
$FailedFields=$FailedFields."email,";
$IsPageGood=false;
}
if (MyEmpty("centerphone"))
{
$GlobalMsg="Please enter the center's phone number.";
$FailedFields=$FailedFields."centerphone,";
$IsPageGood=false;
}
if (MyEmpty("citystatezip"))
{
$GlobalMsg="Please enter the center's city, state, and zip code.";
$FailedFields=$FailedFields."citystatezip,";
$IsPageGood=false;
}
if (MyEmpty("address"))
{
$GlobalMsg="Please enter the address of the center.";
$FailedFields=$FailedFields."address,";
$IsPageGood=false;
}
if (MyEmpty("centername"))
{
$GlobalMsg="Please enter the name of your day care center.";
$FailedFields=$FailedFields."centername,";
$IsPageGood=false;
}
if (MyEmpty("fullname"))
{
$GlobalMsg="Please enter your full name.";
$FailedFields=$FailedFields."fullname,";
$IsPageGood=false;
}
if (strlen($captcha)>0)
{
if (strtoupper($captcha)==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)
{
$msg=("New ChildCare Center Referral:"."\r\n"."\r\n".
"From: ".$fullname."\r\n".
"Email: ".$email."\r\n"."\r\n".
"Saw Us: ".$hearaboutus."\r\n"."\r\n".
"Center Name: ".$centername."\r\n".
"Address: ".$address."\r\n".
"City, State, Zip: ".$citystatezip."\r\n".
"Phone Number: ".$centerphone."\r\n"."\r\n"."\r\n".
"Additional Comments:"."\r\n".$comments);
// $mail is of type "Persits.MailSender"
$mail->Host="mail.nutech.com";
$mail->From=$email;
$mail->FromName=$fullname;
//mail.AddAddress("referral@parent-view.com")
$mail->AddAddress("mathewss@corp.nutech.com");
//mail.AddAddress("scott@nutech.com")
$mail->isHtml=$isHtml;
$mail->Subject="ChildCare Center Referral";
$mail->Body=$msg;
$mail->Send();
$mail=null;
header("Location: "."thankyou.php");
}
return $function_ret;
}
?>