mirror of
https://gitee.com/fastadminnet/think-captcha.git
synced 2026-07-07 00:12:48 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c55455df2 |
@@ -108,18 +108,18 @@ class Captcha
|
|||||||
{
|
{
|
||||||
$key = $this->authcode($this->seKey) . $id;
|
$key = $this->authcode($this->seKey) . $id;
|
||||||
// 验证码不能为空
|
// 验证码不能为空
|
||||||
$secode = Session::get($key);
|
$secode = Session::get($key, '');
|
||||||
if (empty($code) || empty($secode)) {
|
if (empty($code) || empty($secode)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// session 过期
|
// session 过期
|
||||||
if (time() - $secode['verify_time'] > $this->expire) {
|
if (time() - $secode['verify_time'] > $this->expire) {
|
||||||
Session::delete($key);
|
Session::delete($key, '');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->authcode(strtoupper($code)) == $secode['verify_code']) {
|
if ($this->authcode(strtoupper($code)) == $secode['verify_code']) {
|
||||||
$this->reset && Session::delete($key);
|
$this->reset && Session::delete($key, '');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,8 +198,8 @@ class Captcha
|
|||||||
$secode = [];
|
$secode = [];
|
||||||
$secode['verify_code'] = $code; // 把校验码保存到session
|
$secode['verify_code'] = $code; // 把校验码保存到session
|
||||||
$secode['verify_time'] = time(); // 验证码创建时间
|
$secode['verify_time'] = time(); // 验证码创建时间
|
||||||
Session::set($key . $id, $secode);
|
Session::set($key . $id, $secode, '');
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
// 输出图像
|
// 输出图像
|
||||||
imagepng($this->_image);
|
imagepng($this->_image);
|
||||||
|
|||||||
Reference in New Issue
Block a user