在放大镜下,你可以看到每一片雪花都是一幅幅精美的图案:有的是晶莹的薄片,有的像白亮的银针,有的像一把张开的小扇,有的像夜空的星星……
<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['name'];?>" name="name"></td> </tr> <tr align="center"> <td>密码:</td> <td><input type="password" name="password" value="<?php echo $_COOKIE['password']?>"></td> </tr> <tr align="center"> <td>记住用户名和密码</td> <td><?php if($_COOKIE['remember'] == 1){?><input type="checkbox" name="remember" value="1" checked><?php }else{($_COOKIE['remember'] == "")?><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> check_remember.php <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php $name = $_POST['name']; $password = $_POST['password']; $remember = $_POST['remember']; if($remember == 1){ setcookie('name',$name,time()+3600); setcookie('password',$password,time()+3600); setcookie('remember',$remember,time()+3600); }else{ setcookie('name',$name,time()-3600); setcookie('password',$password,time()-3600); setcookie('remember',$remember,time()-3600); } echo "<a rel="nofollow noopener noreferrer" href=\"remember.php\">返回</a>"; ?>
到此这篇关于php使用cookie实现记住用户名和密码实现代码就介绍到这了。更快、更高、更强。领先就是金牌。更多相关php使用cookie实现记住用户名和密码实现代码内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!