首页 > 编程 > PHP > 正文

php基于cookie实现记录用户名和密码

2020-03-22 16:42:16
字体:
来源:转载
供稿:网友
本篇文章主要介绍php基于cookie实现记录用户名和密码,感兴趣的朋友参考下,希望对大家有所帮助。

具体如下:

 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  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 ? 

总结:以上就是本篇文的全部内容,希望能对大家的学习有所帮助。

相关推荐:

PHP单例模式的概念及特点

PHP中类型提示的作用和使用方法

PHP通过Ajax调用连接百度效果实现检测网站是否联网的功能

以上就是php基于cookie实现记录用户名和密码的详细内容,PHP教程

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表