PHP——登录页面与PHP交互

账号:
密码:
确认密码:
//print_r($_POST);      //输出数组
$name=$_POST["name"];
$pwd=$_POST["pwd"];             //获取html页面的name值
$repwd=$_POST["repwd"];
if(empty($name)){
    
                   //判断
    echo "<script>
            alert('用户名必须填写');
            window.location.href='index1.html'     //弹框返回
          </script>";
    die();
}elseif (empty($pwd)){
    
    
    echo "<script>
            alert('密码必须填写');
            window.location.href='index1.html'
          </script>";
    die();
}elseif ($name.$length<6){
    
    
    echo "<script>
            alert('用户名不足6位');
            window.location.href='index1.html'
          </script>";
    die();
}elseif ($pwd.$length<6){
    
    
    echo "<script>
            alert('密码不足6位');
            window.location.href='index1.html'
          </script>";
    die();
}elseif ($pwd!=$repwd){
    
    
    echo "<script>
            alert('密码输入不一致');
            window.location.href='index1.html'
          </script>";
    die();
}elseif($name=="zhouqiqi" && $pwd=="123456789"){
    
    
    echo "<script>
            alert('登陆成功');
          </script>";
    die();
}else{
    
    
    echo "<script>
            alert('用户名或密码输入错误');
            window.location.href='index1.html'
          </script>";
    die();
}

猜你喜欢

转载自blog.csdn.net/zhouqi1427/article/details/107434804