我尝试验证该网站的注册表单。不幸的是,无论我在哪里使用了错误的条目,它都会向我显示第一个状态框:
if(isset($_POST['send'])){
$freshpw = generate_pw();
$mdpassword = md5($freshpw);
$timestamp = mktime(0,0,0,$_POST['month'],$_POST['day'],$_POST['year']);
$reggebdatum = date("d.m.Y",$timestamp);
if (empty($_POST['regusername']) || check_username($_POST['regusername'])){
statusbox("Username is given!", 0);
echo "<div class='sections'>
</div></div>";
header("HTTP/1.1 301 Moved Permanently");
header("refresh:1;url=index.php?act=register");
}
else if(preg_match("/^[A-Z][a-zA-Z -]+$/", $_POST['regname']) === 0){
statusbox("Name can only contains letters spaces and dashes!",0);
echo "<div class='sections'>
</div></div>";
header("HTTP/1.1 301 Moved Permanently");
header("refresh:1;url=index.php?act=register");
}
else if(preg_match("/^[A-Z][a-zA-Z -]+$/", $_POST['regstreet']) === 0){
statusbox("Street can only contains letters spaces and dashes!",0);
echo "<div class='sections'>
</div></div>";
header("HTTP/1.1 301 Moved Permanently");
header("refresh:1;url=index.php?act=register");
}
...
如果我测试它并写下某事。故意错误,例如街道或邮编,它总是向我显示名称中的错误:名称只能包含字母空格和破折号
我做某事。错误的??