我们的非营利网站上最近更改了一个PHP表单。一旦我们填写表单并单击“提交”,表单就会通过,我们看不到任何错误,但另一方面,我们没有收到任何提交申请的电子邮件。我能够理解store_it.php的问题正在发生,我试图调查它(不是一个伟大的PHP人),但我无法看到错误是什么。没有CAPTCHA提交的相同表格之前正在运作,但这个新表现出错。
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<?php
$name = empty($_POST["name"]) ? "" : $_POST["name"];
$lname = empty($_POST["lname"]) ? "" : $_POST["lname"];
$email = empty($_POST["email"]) ? "" : $_POST["email"];
$age = empty($_POST["age"]) ? "-" : $_POST["age"];
$education = empty($_POST["education"]) ? "-" : $_POST["education"];
$country = empty($_POST["country"]) ? "-" : $_POST["country"];
$city = empty($_POST["city"]) ? "-" : $_POST["city"];
$phone = empty($_POST["phone"]) ? "-" : $_POST["phone"];
$zip = empty($_POST["zip"]) ? "-" : $_POST["zip"];
if(!filter_var($email, FILTER_VALIDATE_EMAIL))
{
$email = "-";
}
if(!$name || !$lname || !$email || !filter_var($email, FILTER_VALIDATE_EMAIL))
{
session_start();
if(isset($_POST["captcha"])&&$_POST["captcha"]!=""&&$_SESSION["code"]==$_POST["captcha"])
{
//Captcha is OK Do nothing
}
else
{
// die("Wrong Code Entered");
//Code is not correct
header("location:register.php?name=$name&lname=$lname&age=$age&education=$education&country=$country&city=$city&email=$email&phone=$phone&zip=$zip");
}
}
else
{
$file = "People.txt";
if($name == "123456" && $lname == "123456" && $email == "123456@123456.com")
{
$a = fopen($file, "r");
echo "<table border='1'>";
echo "<tr><th>نام</th><th>نام خانوادگی</th><th>ایمیل</th><th>سن</th><th>تحصیلات</th><th>کشور</th><th>شهر</th><th>تلفن</th><th>کدپستی</th></tr>";
while(!feof($a))
{
$columns = explode('%%%', fgets($a));
if(!empty($columns[0]))
{
echo "<tr><td>".$columns[0]."</td><td>".$columns[1]."</td><td>".$columns[2]."</td><td>".$columns[3]."</td><td>".$columns[4]."</td><td>".$columns[5]."</td><td>".$columns[6]."</td><td>".$columns[7]."</td><td>".$columns[8]."</td></tr>";
}
}
echo "</table>";
fclose($a);
echo "<form action=\"register.php\">\n";
echo "<input type=\"submit\" value=\"Add another\">\n";
echo "</form>\n";
}
else
{
//Write to file
$a = fopen($file, "a");
fwrite($a,$name."%%%");
fwrite($a,$lname."%%%");
fwrite($a,$email."%%%");
fwrite($a,$age."%%%");
fwrite($a,$education."%%%");
fwrite($a,$country."%%%");
fwrite($a,$city."%%%");
fwrite($a,$phone."%%%");
fwrite($a,$zip."%%%\r\n");
fclose($a);
echo "Registration Successful.";
ob_start();
//Navigate
$RegistrationAddress = "https://divineculture.itslearning.com/course/submitpersondata.aspx?CustomerID=2265&Unknown=true&CourseID=4&LanguageID=1&FirstName=".$name."&LastName=".$lname."&Email=".$email."&Save=True";
while (ob_get_status())
{
ob_end_clean();
}
header( "Location: $RegistrationAddress" );
}
}
?>