PHP good verification code
PHP actually has a lot of online, including a lot of mature classes, and the following is a very common PHP verification code, just to let the novice practice learning, the source code is not very complex, directly save it as.P HP, run, and the source of the practical way is very simple, is to judge whether the value of $_SESSION['yanzheng'] and the same as their own, if the same can be verified through, not very difficult principle, not much introduction, run to try it. The
PHP code
[code].Lt;? PHP
session_start ();
function rand_location () / / / / / / / > the number of 4 or so multiples of the difference is 20. Br / > static $rand=0;
$rand =20;
$location.#91; $i.#93; = $rand;
$i;} / >} / >} YuiopQWERTYUIOPASDFGHJKLMNBVCXZ';
for ($i = 0; $i.Lt; 4; $i)
{
$rand.#91; $i.#93; = $range{rand (0, 42)}; Ecolor (100, 30);
$bg = imagecolorallocate ($im, 180239,90);
imagefilledrectangle ($im, 0, 0, 150, 50, $bg);
0; 200. Tpixel ($im, Rand (1, 100), Rand (1, 30), $color);
}
* /
for ($i = 0; $i = 4; > {1, 255) / {1, 255} 10), Rand (80, 100), Rand (10, 30), Rand (0,90), Rand (0, 360), $color);
$location_x = rand_location (); / / / / / / / = = 0; 4 (178, 233), 46, 46, 46, 233); Imagettftext ($im, 20, Rand (0, 60), $location_x.#91; $i.#93; 27, $color,.Quot; C:\WINDOWS\Fonts\simhei.ttf.quot; $rand.#91; $i.#93;);
>;