This commit is contained in:
杜恒 2021-05-17 11:11:20 +08:00
parent 404afe2b07
commit 27906613d9
4 changed files with 6 additions and 8 deletions

View File

@ -1,11 +1,9 @@
<?php <?php
/* 生成图片验证码 */
session_start(); session_start();
header("Content-type: image/png"); header("Content-type: image/png");
$image = imagecreatetruecolor(85, 40); $image = imagecreatetruecolor(85, 25);
$bgcolor = imagecolorallocate($image, 255, 255, 255); $bgcolor = imagecolorallocate($image, 255, 255, 255);
imagecolortransparent($image, $bgcolor); imagecolortransparent($image, $bgcolor);
imagefill($image, 0, 0, $bgcolor); imagefill($image, 0, 0, $bgcolor);
@ -17,7 +15,7 @@ $captcha = "";
/* 绘制干扰点 */ /* 绘制干扰点 */
for ($i = 0; $i < 80; $i++) { for ($i = 0; $i < 80; $i++) {
$pointColor = imagecolorallocate($image, rand(100, 255), rand(100, 255), rand(100, 255)); $pointColor = imagecolorallocate($image, rand(100, 255), rand(100, 255), rand(100, 255));
imagesetpixel($image, rand(0, 85), rand(0, 40), $pointColor); imagesetpixel($image, rand(0, 85), rand(0, 25), $pointColor);
} }
/* 绘制验证码 */ /* 绘制验证码 */
@ -27,7 +25,7 @@ for ($i = 0; $i < 4; $i++) {
$fontContent = rand(0, 9); $fontContent = rand(0, 9);
$captcha .= $fontContent; $captcha .= $fontContent;
$x = ($i * 85 / 4) + 7; $x = ($i * 85 / 4) + 7;
$y = rand(10, 15); $y = rand(3, 8);
imagestring($image, $fontSize, $x, $y, $fontContent, $fontColor); imagestring($image, $fontSize, $x, $y, $fontContent, $fontColor);
} }

View File

@ -2,7 +2,7 @@
/* 获取主题当前版本号 */ /* 获取主题当前版本号 */
function _getVersion() function _getVersion()
{ {
return "6.9.6"; return "6.9.7";
}; };
/* 判断是否是手机 */ /* 判断是否是手机 */

View File

@ -1,6 +1,6 @@
{ {
"name": "typecho-joe-next", "name": "typecho-joe-next",
"version": "6.9.6", "version": "6.9.7",
"description": "A Theme Of Typecho", "description": "A Theme Of Typecho",
"main": "index.php", "main": "index.php",
"keywords": [ "keywords": [

View File

@ -27,7 +27,7 @@
</div> </div>
<div class="list captcha"> <div class="list captcha">
<input maxlength="4" type="text" autocomplete="off" name="captcha" placeholder="请输入验证码..." /> <input maxlength="4" type="text" autocomplete="off" name="captcha" placeholder="请输入验证码..." />
<img style="cursor: pointer;" src="<?php $this->options->themeUrl('core/captcha.php'); ?>" onclick="this.src = this.src"> <img style="cursor: pointer; margin-right: 5px;" src="<?php $this->options->themeUrl('core/captcha.php'); ?>" onclick="this.src = this.src">
</div> </div>
</div> </div>
<div class="body"> <div class="body">