?? captcha_non_gd.php
字號:
<?php/** ** @package VC* @version $Id: captcha_non_gd.php,v 1.7 2006/12/03 17:36:58 davidmj Exp $* @copyright (c) 2006 phpBB Group * @license http://opensource.org/licenses/gpl-license.php GNU Public License **//*** Main non-gd captcha class* @ignore* @package VC*/class captcha{ var $filtered_pngs; var $width = 320; var $height = 50; /** * Define filtered pngs on init */ function captcha() { // If we can we will generate a single filtered png, we avoid nastiness via emulation of some Zlib stuff $this->define_filtered_pngs(); } /** * Create the image containing $code with a seed of $seed */ function execute($code, $seed) { $img_height = $this->height - 10; $img_width = 0; mt_srand($seed); $char_widths = $hold_chars = array(); $code_len = strlen($code); for ($i = 0; $i < $code_len; $i++) { $char = $code[$i]; $width = mt_rand(0, 4); $raw_width = $this->filtered_pngs[$char]['width']; $char_widths[$i] = $width; $img_width += $raw_width - $width; // Split the char into chunks of $raw_width + 1 length if (empty($hold_chars[$char])) { $hold_chars[$char] = str_split(base64_decode($this->filtered_pngs[$char]['data']), $raw_width + 1); } } $offset_x = mt_rand(0, $this->width - $img_width); $offset_y = mt_rand(0, $this->height - $img_height); $image = ''; for ($i = 0; $i < $this->height; $i++) { $image .= chr(0); if ($i > $offset_y && $i < $offset_y + $img_height)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -