用户
 找回密码
 入住 CI 中国社区
搜索
查看: 1343|回复: 1
收起左侧

求助:验证码偶尔验证不正确

[复制链接]
发表于 2013-6-7 16:21:01 | 显示全部楼层 |阅读模式
用CI的验证码,不是用的数据库。正常情况是好用的,只是有时明明输入的验证和显示的图片一样但是提示不正确。在什么情况下会有这样的效果呢。求解答。。。。
 楼主| 发表于 2013-6-8 12:00:29 | 显示全部楼层
本帖最后由 sfks8282 于 2013-6-8 12:35 编辑

if ($this->sess_encrypt_cookie == TRUE)//用加密方式正常
  {
   $session = $this->CI->encrypt->decode($session);
  }
  else//非加密方式有问题,字符串一样,但是MD5值不同。。。
  {
   // encryption was not used, so we need to check the md5 hash
   $hash  = substr($session, strlen($session)-32); // get last 32 chars
   $session = substr($session, 0, strlen($session)-32);
   
   // Does the md5 hash match?  This is to prevent manipulation of session data in userspace
   if ($hash !==  md5($session.$this->encryption_key))//这里不相等
   {
    log_message('error', 'The session cookie data did not match what was expected. This could be a possible hacking attempt.');
    $this->sess_destroy();
    return FALSE;
   }
  }

本版积分规则