php-PHP使用cookie制作登陆界面

WBOY
Release: 2016-06-02 11:32:56
Original
833 people have browsed it

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>
Copy after login

?>

用户名:

密码:


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template