📄 captcha_non_gd.php
字号:
if ($i > $offset_y && $i < $offset_y + $img_height) { for ($j = 0; $j < $offset_x; $j++) { $image .= chr(mt_rand(140, 255)); } for ($j = 0; $j < $code_len; $j++) { $image .= $this->randomise(substr($hold_chars[$code{$j}][$i - $offset_y - 1], 1), $char_widths[$j]); } for ($j = $offset_x + $img_width; $j < $this->width; $j++) { $image .= chr(mt_rand(140, 255)); } } else { for ($j = 0; $j < $this->width; $j++) { $image .= chr(mt_rand(140, 255)); } } } unset($hold_chars); $image = $this->create_png($image, $this->width, $this->height); // Output image header('Content-Type: image/png'); header('Cache-control: no-cache, no-store'); echo $image; exit; } /** * This is designed to randomise the pixels of the image data within * certain limits so as to keep it readable. It also varies the image * width a little */ function randomise($scanline, $width) { $new_line = ''; $end = strlen($scanline) - ceil($width/2); for ($i = floor($width/2); $i < $end; $i++) { $pixel = ord($scanline{$i}); if ($pixel < 190) { $new_line .= chr(mt_rand(0, 205)); } else if ($pixel > 190) { $new_line .= chr(mt_rand(145, 255)); } else { $new_line .= $scanline{$i}; } } return $new_line; } /** * This creates a chunk of the given type, with the given data
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -