dongxietao0263 2017-09-16 07:08
浏览 53

如何修复我的Web Cookie会话超时

Am trying to make my cookies timeout unlimited. When users login it usually log them out after sometimes in that same day. Presently am out of Ideas, i need help on how to fix it.

This is the code below.

$CookieExpire    =    86400;    
$time    =    30    *    $CookieExpire;    
$time    =    time()    +    $time;    
$key    =    $username . date('mY');    
$key    =    strtoupper(md5($key));    
setcookie    ("sessionkey",     "$key",    "$time");    
setcookie    ("user",    "$username",    "$time");    
setcookie    ("password",    "$password",    "$time");
  • 写回答

1条回答 默认 最新

  • dongyin8009 2017-09-16 07:21
    关注

    md5 is not secure you can use jwttoken to make token and store you data there. And to store jwt token ( for now you cab store string generating by md5 ) in cookie and make it for 100 years like this.

    setcookie( "user", $username, time()+(60*60*24*365*100) );
    

    More about cookie : http://php.net/manual/en/features.cookies.php

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料