Home >Backend Development >PHP Tutorial >Code to implement cookie in PHP to remember username and password (picture and text)

Code to implement cookie in PHP to remember username and password (picture and text)

PHP中文网
PHP中文网Original
2017-03-30 14:45:381873browse

php cookie implements the code to remember user names and passwords

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<form id="form1" name="form1" method="post" action="check_remember.php">
<table width="300" border="1" align="center" cellpadding="0" cellspacing="0">
<thead>
<tr>
<td colspan="2" align="center"><b>记住用户名和密码</b></td>
</tr>
</thead>
<tr align="center">
<td>用 户 名:</td>
<td><input type="text" value="<?php echo $_COOKIE[&#39;name&#39;];?>" name="name"></td>
</tr>
<tr align="center">
<td>密码:</td>
<td><input type="password" name="password" value="<?php echo $_COOKIE[&#39;password&#39;]?>"></td>
</tr>
<tr align="center">
<td>记住用户名和密码</td>
<td><?php if($_COOKIE[&#39;remember&#39;] == 1){?><input type="checkbox" name="remember" value="1" checked>
<?php }else{($_COOKIE[&#39;remember&#39;] == "")?><input type="checkbox" name="remember" value="1"><?php }?></td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" name="Submit" value="提交" /></td>
</tr>
</table>
</form>

2. Password detection page-check_remember.php

The above is the content of php cookie implements the code (pictures and texts) to remember user names and passwords, more For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Statement:
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