background image

php 基于 cookie 的登录表单

本文介绍下,基于

cookie 实现的一个 php 登录表单,且可以记录下最后的登录时间,有需

要的朋友参考下。

一个基于

cookie 原理实现的登录表单。

代码:

<html>
  <head>
  <title>用户登录表单</title>
  </head>
  <body>
  <form name="forml" method="POST" action="CookieBasedPasswordLogin.php">
    <table>
      <tr>
       <td colspan="2" >
         <div align="center"><b>请输入用户名与密码</b></div>
       </td>
     </tr>
   <tr>>
     <td>
       <div align="right">Customer ID</div>
     </td>
     <td>
       <input type="text" name="username">
     </td>
   </tr>
   <tr>
     <td>
       <div align="right">Password</div>
     </td>
     <td>
       <input type="password" name="password">
     </td>
   </tr>
   <tr>
     <td colspan="2">
       <center>
         <input type="submit" name="Submit" value="Login">
       </center>
     </td>
    </tr>