www.gusucode.com > HadSky PHP轻论坛系统源码 v2.4.2源码程序 > ytqlt_v2.4.2.0701/phpscript/verifycode.php
<?php if (!defined('puyuetian')) exit('Not Found puyuetian!Please contact QQ632827168'); $_rnd = rand(10000, 99999); $verifycode = substr($_rnd, 1); if ($type) { $type = strtoupper($type); $_e = "_{$type}"; } $_SESSION["VERIFYCODE{$_e}"] = $verifycode; $image = imagecreate(105, 39); imagecolorallocate($image, 55, 130, 240); $white = imagecolorallocate($image, 255, 255, 255); for ($i = 0; $i < strlen($verifycode); $i++) { $newverifycode .= substr($verifycode, $i, 1) . " "; } $verifycode = substr($newverifycode, 0, strlen($newverifycode) - 1); imagestring($image, 5, 22, 12, $verifycode, $white); ob_clean(); //flush(); header("Content-Type:image/png"); imagepng($image); exit();