![]() |
|
Decent and low powered captcha example - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: PHP (https://sinister.li/Forum-PHP) +--- Thread: Decent and low powered captcha example (/Thread-Decent-and-low-powered-captcha-example) |
Decent and low powered captcha example - Vertigo - 06-18-2015 It is pretty unreadable to bots, but if you can make one that can still do it, I will improve this script and throw free shit at you. Code: <?php
session_start();
$cap=rand(10000,99999);
$_SESSION["cap"]=$cap;
$im = imagecreatetruecolor(50, 24);
$bg = imagecolorallocate($im, 64, 63, 77);
$a1 = imagecolorallocate($im, rand(0,180), rand(0,180), rand(0,180));
$a2 = imagecolorallocate($im, rand(0,180), rand(0,180), rand(0,180));
$a3 = imagecolorallocate($im, rand(0,180), rand(0,180), rand(0,180));
$fg = imagecolorallocate($im, rand(200, 255), rand(200, 255), rand(200, 255));
imagefill($im, 0, 0, $bg);
imagestring($im, 2, rand(1,17), rand(1,7), rand(100,999), $a1);
imagestring($im, 5, rand(1,17), rand(1,7), rand(100,999), $a2);
imagestring($im, 1, rand(1,17), rand(1,7), rand(100,999), $a3);
imagestring($im, 4, 5, 5, $cap, $fg);
header("Cache-Control: no-cache, must-revalidate");
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?> |