我需要将所有 if 语句合并为一个。所以,如果有人在网上冲浪有点无聊,我会很感激一些输入=)
我目前正在玩一些其他功能,如果有任何变化,我会更新。
谢谢!
if($_REQUEST['do'] == 'register') {
$pass_length = strlen($_POST["password1"]);
$username_length = strlen($_POST["username"]);
$name_length = strlen($_POST["name"]);
$email_length = strlen($_POST["email"]);
if($_POST["verification"] != $_POST["verification_base"]){
echo "Hey dummy, your verification code does not match!<br>";
$process = "no";
}
if($_POST["password1"] != $_POST["password2"]){
echo "Your damn passwords do not match!<br>";
$process = "no";
}
if($pass_length <= "3") {
echo "Your password needs to be more than 3 characters long!<br>";
$process = "no";
}
if($username_length <= "3"){
echo "Your user name needs to be more than 3 characters long!<br>";
$process = "no";
}
if($name_length <= "2"){
echo "Please enter a name more than 2 characters long!<br>";
$process = "no";
}
if ($email_length <= "6"){
echo "Please enter a valid email address!<br>";
$process = "no";
}
$username = $_POST["username"];
$name = $_POST["name"];
$email = $_POST["email"];
$password1 = $post["password1"];
if ($process != "no"){ mysqli_query(
$con,
"INSERT INTO $sqlusers (username, password, email) VALUES ('$username', '$password', '$email')"
);}
}