zoukankan      html  css  js  c++  java
  • php写一个简洁的登录页面

    在学php中,刚刚看完实战演练就写了个登录页面

    1.表单解析图

    这是我们要写的

    先用html写个表单先

    <html>
    <head>
    <title>login</title>
    <style>
    #dog{
      text-align:center;
    }
    </style>
    </head>
    <body>
    <div id="dog">
    <form method="POST" action="login.php">
    登录的admin<br>
    账号:<input type="username" name="username"><br>
    密码:<input type="password" name="upass"><br>
    <input type="submit" value="登录">
    </form>
    </div>
    </body>
    <html>

    登录表单图:

     php源码

    <?php
    //博主暂时没有学到SQL,所以使用元祖来暂时代替
    $userpass=array('admin', '123456' );
    //判断username和password是否为空
    if(!$_POST['username']|| !$_POST['upass']){ echo"请输入账号密码"; }else{
    //不为空,判断密码是否正确
    $username=$_POST['username']; $password=$_POST['upass']; if($userpass[$username]==$password){ echo"$username,你好"; } else{ echo"账号密码不正确"; } } ?>
  • 相关阅读:
    样式
    读取网页图片(包含代理)
    C# 替换“换行符”写法
    Iframe中弹出消息问题
    程序list
    C#对象序列化
    软件工程——个人总结
    软件工程——团队作业4
    软件工程———团队答辩
    软件工程--团队作业三
  • 原文地址:https://www.cnblogs.com/haq5201314/p/7816045.html
Copyright © 2011-2022 走看看