VOLUNTEER FORM
Virtually all of Tomorrow A Child's staff volunteer their time and energy to help couples achieve their dreams.
if (!isset($_POST['action'])) {
$action="none";
} ELSE {
$action=$_POST['action'];
}
if (isset($_POST['Name'])) {
$Name=$_POST['Name'];
}
if (isset($_POST['Home_Phone'])) {
$Home_Phone=$_POST['Home_Phone'];
}
if (isset($_POST['Cell_Phone'])) {
$Cell_Phone=$_POST['Cell_Phone'];
}
if (isset($_POST['Fax'])) {
$Fax=$_POST['Fax'];
}
if (isset($_POST['Best_Time'])) {
$Best_Time=$_POST['Best_Time'];
}
if (isset($_POST['liame'])) {
$liame=$_POST['liame'];
}
if (isset($_POST['City'])) {
$City=$_POST['City'];
}
if (isset($_POST['category'])) {
$category=$_POST['category'];
}
if (isset($_POST['Comments'])) {
$Comments=$_POST['Comments'];
}
if (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 = $HTTP_SERVER_VARS['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,$Home_Phone,$Cell_Phone,$Fax,$Best_Time,$liame,$City,$Comments,$category,$http_referrer,$ip);
}
sendEMail($emailto,$subject,$Name,$Home_Phone,$Cell_Phone,$Fax,$Best_Time,$liame,$City,$Comments,$category,$http_referrer,$ip,$newid);
message('Thank you.
Your information has been submitted.');
}else{
echo '
There was an error submitting this form. Please contact our office. (TT-'.$totaltime.')
';
}
break;
default :
showFrm();
}
function showFrm()
{
?>
}
function insert($Name,$Home_Phone,$Cell_Phone,$Fax,$Best_Time,$liame,$City,$Comments,$category,$http_referrer,$ip)
{
global $database_main,$main,$sql;
$Comments=addslashes($Comments);
$sql = "INSERT INTO `contact` (date,Name,Home_Phone,Cell_Phone,Fax,Best_Time,liame,City,Comments,category,http_referrer,ip)
VALUES (NOW(),'$Name','$Home_Phone','$Cell_Phone','$Fax','$Best_Time','$liame','$City','$Comments','$category','$http_referrer','$ip')";
//message ($sql);
mysql_select_db($database_main, $main);
$id = mysql_query($sql);
$id = mysql_insert_id();
return $id;
}
function sendEmail($emailto,$subject,$Name,$Home_Phone,$Cell_Phone,$Fax,$Best_Time,$liame,$City,$Comments,$category,$http_referrer,$ip,$newid)
{
$Comments = stripslashes( $Comments );
if($InsertDB == 1) {
$newid = ' Reference # '.$newid;
}
$email_message = 'The following volunteer form has just been submitted.
Name: '.$Name.'
Home Phone: '.$Home_Phone.'
Cell Phone: '.$Cell_Phone.'
Fax: '.$Fax.'
Best Time to be reached: '.$Best_Time.'
Email: '.$liame.'
City, State: '.$City.'
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
";
}
?>
|