I don't think there is an array statement. I am getting errors on all of the $texts statements. I am not that familar with php.
This is the code starting at line 18...the first lines are just comments.
<?php
$urlofthisfile = "
http://10.9.0.6/change/12validateform.php"; // absolute url to this script.
$fromforconfirmmail = "
admin@grady.k12.ga.us"; // emailaddres the visitor sees as from.
$emailfordatamail = "
admin@grady.k12.ga.us"; // emailaddress to send the data to
// Some redirects to inform the visitor of your site.
$noticepage = "notice.html"; //Page to tell the author of the form that a confirmation mail has been send to his/her address
$confirmdeletepage = "cancellation.html"; // Page to redirect the authorafter he/she canceled.
$confirmsendpage = "confirmation.html"; // Page to redirect the authorafter he/she confirmed.
$maxnrofdaystopkeepdata = 2; //number of days the confirmation is valid;
// texts used in the script. Try the script a few times to figure out where these texts belong and what they say exactly.
$texts[emailerror]="You did not give a valid email."; //do not use a ', or comment it out like this: ''
$texts[blankfields]="You did not fill in"; //do not use a ', or comment it out like this: ''
$texts[errors]="The following errors occurred:"; //do not use a ', or comment it out like this: ''
$texts[novalidentry]="You didn''t use a valid confirmation link or your form data has allready expired"; //do not use a ', or comment it out like this: ''
$texts[confirmmailsubject]="Please confirm!"; // subject of confirmation mail send to visitor
$texts[datamailsubject]="Data from contact form"; //subject of data mail send to you
////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////// You do not need to change anything below this line ////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
$maxtime = mktime() - ($maxnrofdaystopkeepdata * 86400);
$handle=opendir("data");
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$filetime = filemtime("data/".$file);
if ($filetime < $maxtime){
unlink("data/".$file);
}
}
}
closedir($handle);
if (isset($C)){
$file = "data/".$S.".txt";
if (file_exists($file)){
if ($C == "y"){
$fp = fopen($file,"r");
$contents = fread ($fp, filesize($file));
fclose($fp);
$contents = explode("%%%%",$contents);
$email = $contents[0];
$vars = explode("#$%&%$#",$contents[1]);
$vals = explode("#$%&%$#",$contents[2]);
$fp = fopen("messages/data.txt","r");
$message = fread ($fp, filesize("messages/data.txt"));
fclose($fp);
for ($k=0;$k<count($vars);$k++){
$var = $vars[$k];
$val = $vals[$k];
if ($var!="compulsory" && (strtolower($var)!="submit" && strtolower($var)!="reset")){
$formdata .= $var.": ".$val."\n";
$message = str_replace("%$var%",$val,$message);
}
}
$message = str_replace("%formdata%",$formdata,$message);
$from = "From: " . $email;
mail($emailfordatamail, "$texts[datamailsubject]", $message, $from);
unlink($file);
header("Location: $confirmsendpage");
exit;
} elseif ($C == "n"){
unlink($file);
header("Location: $confirmdeletepage");
exit;
}
}
echo "<html>\n<head>\n<script>\n<!--\nalert('".$texts[novalidentry]."');\n";
echo "history.go(-1);\n//-->\n</script>\n</head>\n</html>";
exit;
} elseif (isset($HTTP_POST_VARS)){
$varkeys = array_keys($HTTP_POST_VARS);
$email= $email
if (!eregi ("^[a-zA-Z0-9_.-]+@grady.k12.ga.us", $email)) {
$error = $texts[emailerror];
}
if (isset($compulsory)){
for($i=0;$i<count($varkeys);$i++){
$var = $varkeys[$i];
$val = $HTTP_POST_VARS[$var];
if (in_array($var, $compulsory)&&($val==""||!isset($val))){
$errors[]=$var;
}
}
}
if (isset($error)||isset($errors)){
echo "<html>\n<head>\n<script>\n<!--\nalert('";
echo $texts[errors]."\\n";
if (isset($error)){
echo "- ".$error."\\n";
}
if (isset($errors)){
echo "- ".$texts[blankfields]." ";
for ($j=0;$j<count($errors);$j++){
echo $errors[$j]." ";
}
}
echo "');\nhistory.go(-1);\n//-->\n</script>\n</head>\n</html>";
exit;
}
$S = md5(uniqid(rand()));
$confirmlink = $urlofthisfile."?C=y&S=".$S;
$cancellink = $urlofthisfile."?C=n&S=".$S;
$fp = fopen("messages/confirm.txt","r");
$message = fread ($fp, filesize("messages/confirm.txt"));
fclose($fp);
for ($k=0;$k<count($varkeys);$k++){
$var = $varkeys[$k];
$val = stripslashes($HTTP_POST_VARS[$var]);
if ($var!="compulsory" && (strtolower($var)!="submit" && strtolower($var)!="reset")){
$formdata .= $var.": ".$val."\n";
$message = str_replace("%$var%",$val,$message);
}
}
$message = str_replace("%confirmlink%",$confirmlink,$message);
$message = str_replace("%cancellink%",$cancellink,$message);
$message = str_replace("%formdata%",$formdata,$message);
$vars = implode("#$%&%$#",$varkeys);
$vals = implode("#$%&%$#",$HTTP_POST_VARS);
$data = $email."%%%%".$vars."%%%%".$vals;
$file = "data/".$S.".txt";
$fp = fopen($file,"a");
fputs($fp,$data);
fclose($fp);
$from = "From: " . $fromforconfirmmail;
mail($email, "$texts[confirmmailsubject]", $message, $from);
header("Location: $noticepage");
exit;
} else {
exit;
}
?>