请教php如何实现“记住密码”的功能...还有当我点击“退出”后,登陆框里能保存用户名和密码,就像QQ登陆界面一样。
解决方案 »
- 请各位看看这段php代码中的javascript中的$是什么意思
- 升双星!散分 面试求祝福
- 请问哪里能下到XAMP(一个 Apache-MySQL-PHP包),多谢大家
- mysql 插入gzcompress后的数据总是 ‘x’,为什么
- 求一个php开源的oa系统
- zencart seo 静态问题
- 提个最简单的问题,散点分!!!
- lampp 如何 配置Fast-CGI和php-snmp扩展
- #1045 - Access denied for user 'you'@'localhost' (using password: YES)
- php获取数据库最后3条数据
- 织梦,帮忙看看我这个问题怎么实现才好
- fckeditor调用的问题
<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 href=\"remember.php\">返回</a>";
?>