Rumah >pembangunan bahagian belakang >tutorial php >php-PHP使用cookie制作登陆界面
phpcookie
小白菜鸟刚刚开始学PHP,555老是做不粗来,心塞塞啊。。木有钱,跪求好心人帮忙
这个登录界面总是会有bug,但是不知道要怎么改进,求帮忙啦!!
/*
登录界面
*/
error_reporting(E_ALL ^E_NOTICE);
<code> if($_GET['out']) { setcookie("cookie","out"); echo "<script>location='login.php';</script>"; } if($_POST['user']=='admin' && $_POST['pw']=='123') { /*setcookie("cookie","ok"); echo "<script language='\"javascript\"'> location.href='login.php';</script>";*/ setcookie("cookie","ok"); echo "<script>location='login.php';</script>"; } if($_COOKIE['cookie']!='ok') { echo "<script>alert('用户名或密码不正确');</script>"; } else { echo "<script>alert('登陆成功');</script>"; echo "<a href="login.php?out=out">退出</a>"; }</code>
?>
用户名: