session_start();
header("Content-type:text/html;charset=utf-8");
$link = mysqli_connect('localhost','123654lgh', 'etjyr2bm','123654lgh');
if (!$link) {
die("连接失败:".mysqli_connect_error());
}
$sql = "select * from login";
$result = mysqli_query($link, $sql);
$rows = mysqli_fetch_array($result);
$username = $_POST['username'];
$password = $_POST['password'] ;
$confirm = $_POST['confirm'];
$email = $_POST['email'];
if($username == "" || $password == "" || $ confirmer == "" || $email == "")
if ((strlen($username) < 3)||(!preg_match('/^w+$/i', $username)))
{
echo "";
} elseif ((strlen($username ) < 3)||(!preg_match('/^w+$/i', $username))) {
echo "";
//判断用户名长度
}elseif(strlen($password) < 5){
echo "";
//判断密码长度
}elseif($password != $confirm) {
echo "";
//检测两次输入密码是否相同
} elseif (!preg_match('/^[w.]+@w+.w+$/i', $email))
echo "";
//判断邮箱格式是否合法
elseif(mysqli_fetch_array(mysqli_query($link,"select * from login which username = '$username '"))){
echo "";
} else{
$ sql= "insérer dans le login(nom d'utilisateur, mot de passe, confirmation, email)values('$username','$password','$confirm','$email')";
//插入数据库
if(! (mysqli_query($link,$sql))){
echo "";
}
}
?>
Il s'agit d'une invite du client. Si vous soumettez un formulaire sur la page, vous verrez l'invite lorsque vous l'actualiserez. Ce n'est pas un problème d'erreur de code
.