Skip to content

Commit

Permalink
✨ 优化验证码多次可能500的错误及结构 #266
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Jun 10, 2023
1 parent 5c721e0 commit 02f2f65
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion inc/fun/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ function pk_ajax_resp_error($msg = 'fail', $data = null)
require_once PUOCK_ABS_DIR . '/inc/fun/comment-notify.php';
require_once PUOCK_ABS_DIR . '/inc/user-agent-parse.php';
require_once PUOCK_ABS_DIR . '/inc/phpqrcode.php';
require_once PUOCK_ABS_DIR . '/inc/php-captcha.php';
require_once PUOCK_ABS_DIR . '/inc/ajax/index.php';
if (pk_is_checked('no_category')) {
require_once PUOCK_ABS_DIR . '/inc/no-category.php';
Expand Down
1 change: 1 addition & 0 deletions inc/fun/opt.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ function pk_captcha()
}
$width = $_GET['w'];
$height = $_GET['h'];
include_once PUOCK_ABS_DIR.'/inc/php-captcha.php';
$captcha = new CaptchaBuilder();
$captcha->initialize([
'width' => intval($width), // 宽度
Expand Down
6 changes: 3 additions & 3 deletions inc/php-captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ private function getDeepColor()
list($red,$green,$blue) = $this->getRandColor();
$increase = 30 + mt_rand(1,254);

$red = abs(min(255,$red - $increase));
$green = abs(min(255,$green - $increase));
$blue = abs(min(255,$blue - $increase));
$red = abs(min(255,abs($red - $increase)));
$green = abs(min(255,abs($green - $increase)));
$blue = abs(min(255,abs($blue - $increase)));

return [$red,$green,$blue];
}
Expand Down

0 comments on commit 02f2f65

Please sign in to comment.