33 $hex = str_replace(
"#",
"", $hex);
35 $r = hexdec(substr($hex,0,2));
36 $g = hexdec(substr($hex,2,2));
37 $b = hexdec(substr($hex,4,2));
38 return array($r, $g, $b);
45 header(
"Content-Type: image/png");
67 $md5_hash = md5(rand(0,99999));
68 $security_code = substr($md5_hash, 25, 6);
69 $enc = md5($security_code);
72 $_SESSION[
'captcha'] = $enc;
76 $black = imageColorAllocate($image, 0, 0, 0);
79 if (!empty($_GET[
'color']) && ((strlen($_GET[
'color']) == 6) || (strlen($_GET[
'color']) == 7))) {
81 $fontColor = imageColorAllocate($image, $rgb[0], $rgb[1], $rgb[2]);
86 imageFill($image, 0, 0, $black);
87 imageColorTransparent($image, $black);