//check if loser is trying again
$remoteADDR=$_SERVER{REMOTE_ADDR};
$checkBlock=`grep "^$remoteADDR\$" ./blocked.ips.txt`;
if ($checkBlock){
echo "
\n".
"It seems that someone with your IP address made a very bad impression on us earlier. contact-form.\n".
"
";
exit;
}
require("library.php");
$script="get_involved.php";
///>> simply check the required fields
$required=array('Name','Address','City','State','Zip','Phone','Email','contactPreference');
$checkProfanityArray=array('Name','Address','City','State','Zip','Phone','Email','contactPreference','skillsComments');
if ($action=="submitInfo")
{
checkProfanity($Name,$Address,$City,$State,$Zip,$Email,$skillsComments,$Phone);
checkBlockedNames($Name);
foreach ($required as $loop)
{
if (!$$loop || ($loop=="email" && !preg_match("/\@/",$$loop)))
{
$errorOnPage.="Please fill in $loop\n ";
$missingData=1;
$javascript="alert('You are missing required fields');\n";
}
}
list ($testInvID)=get_mysql("select InvID from involved where Email='$Email' && name='$Name'",10);
if ($missingData)
{
$action="";
}
elseif ($testInvID)
{
$javascript="alert('We already have a submission from you.');\n";
$errorOnPage="We already have a submission from you.\n ";
$action="";
}
else {
//>> check profanity
checkProfanity($Name,$Address,$City,$State,$Zip,$Email,$skillsComments,$Phone);
///>> do the insert
if ($Contribute)
{
foreach ($Contribute as $loop)
{
$ContributeInsert.="|$loop|";
}
}
if ($taskForce)
{
foreach ($taskForce as $loop)
{
$taskForceInsert.="|$loop|";
}
}
if (!$signedPetition) {$signedPetition="No";}
get_mysql("insert into involved
(InvID,Name,Address,City,State,Zip,Email,
contactPreference,Contribute,taskForce,
skillsComments,signedPetition,phone)
values
(null,'$Name','$Address','$City','$State',
'$Zip','$Email','$contactPreference',
'$ContributeInsert','$taskForceInsert','$skillsComments','$signedPetition',
'$Phone')",3);
$errorOnPage="Thank you for your submission.\n ";
$action="";
$Name=""; $Address=""; $City=""; $State=""; $Zip=""; $Email=""; $contactPreference=""; $ContributeInsert=""; $taskForceInsert=""; $skillsComments="";
}
}
if ($action=="")
{
if ($javascriptAlert)
{
$javascript.="alert('$javascriptAlert');\n\n";
}
$html=getFileContents($templates."get_involved.htm");
$html=preg_replace("/%%JAVASCRIPT%%/",$javascript,$html);
$html=preg_replace("/%%ERROR%%/",$errorOnPage,$html);
$html=preg_replace("/%%SCRIPT%%/",$script,$html);
if ($subAction=="signedPet")
{
list ($test)=get_mysql("select PID from petition where Email='$Email' && name='$Name'",10);
if ($test)
{
list ($Address,$City,$State,$Zip,$Phone)=get_mysql("select Address,City,State,Zip,concat('(',AC,') ',Phone) from petition where Email='$Email' && name='$Name'",10);
}
$html=preg_replace("/%%CHECKED%%/","checked",$html);
}
$fillIN=array('Name','Address','City','State','Zip','Phone','Email','contactPreference','Contribute','taskForce','skillsComments');
foreach ($fillIN as $loop)
{
$replace=strtoupper($loop);
if ($loop=="contactPreference" && $$loop)
{
$ins=$$loop;
$replace.="OPTION";
$html=preg_replace("/%%$replace%%/","",$html);
}
elseif ($loop=="Contribute" || $loop=="taskForce")
{
$ins=$$loop;
$replace.="OPTION"; $options="";
if ($$loop)
{
foreach ($$loop as $loopTwo)
{
$options.="\n";
}
}
$html=preg_replace("/%%$replace%%/",$options,$html);
}
else {
$html=preg_replace("/%%$replace%%/",$$loop,$html);
}
}
echo $html;
exit;
}
///////////////////////////////
function checkProfanity($Tname,$Taddress,$Tcity,$Tstate,$Tzip,$Temail,$TskillsComments,$TPhone)
///////////////////////////////
{
$head=`head -n 1 profanity.txt`;
$head=preg_replace("/\s+$/","",$head);
$profanityArray=array();
$profanityArray=preg_split("/,/",$head);
$fieldArray=array('Taddress','Tcity','Tstate','Tzip','Temail','TskillsComments','TPhone');
foreach ($fieldArray as $loop)
{
foreach ($profanityArray as $loopTwo)
{
if (preg_match("/$loopTwo/",$$loop))
{
$blocked=1;
}
}
}
if ($blocked)
{
///>> put ip in file
$remote=$_SERVER{REMOTE_ADDR};
`echo $remote >> ./blocked.ips.txt`;
echo "The use of profanity in this form in prohibited and you have been blocked from submitting your comments.";
exit;
}
}
?>