Login for PHP development enterprise website (1)
The page in this section is log.php
Let’s take a look at the following specific code:
<?php session_start(); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php 登錄</title> <style type="text/css"> *{margin: 0px;padding: 0px;} body{background:#eee;} .inpu{border-radius:10px;outline:none;width:200px;height:30px;border:1px solid red; box-sizing:border-box;padding-left:15px; } #div{width:400px;height:400px;background:#B1FEF9;margin:0 auto; margin-top:150px;border-radius:20px;} h3{margin-left:88px;padding-top:60px;} h4{margin-left:120px;padding-top:60px;font-size: 18px;} #cnt{width:280px;height:370px;margin-left:33px;padding-top:60px;} .sub{width:70px;height:30px;border:1px solid #fff;background:#eee; margin-left:28px;margin-top:20px;} .sub1{width:70px;height:30px;border:1px solid #fff; background:#eee;margin-left:150px;margin-top:20px;} </style> </head> <body> <div id="div"> <h3>歡迎登陸后臺管理系統(tǒng)</h3> <div id="cnt"> <form method="post" action="login.php"> 用戶名:<input type="text" placeholder="請輸入用戶名" name="username" class="inpu"> <br><br> 密 碼:<input type="password" placeholder="請輸入密碼" name="password" class="inpu"> <br><br> <input type="submit" value="登錄" class="sub"> </form> </div> </div> </body> </html>
Let’s take a look at the above code, and then everyone will look at the following. The form is submitted to login.php
In this file, we opened session which was written for later needs. We will explain the login processing in the next section