read()) { if(stristr($font,'.ttf')) $fontList[] = "cFonts/".$font; } $folder->close(); for ($i = 0; $i < 5; $i++) { $cnum[$i] = rand(0,9); $rC = rgb_rand(0, 175); $rColors[$i] = imagecolorallocate($image, $rC['r'], $rC['g'], $rC['b']); for ($x = 0; $x < 2; $x++) { $x1 = rand(0,140); $y1 = rand(0,40); $x2 = rand(0,140); $y2 = rand(0,40); imageline($image, $x1, $y1, $x2, $y2 , $rColors[$i]); } } /* generate random dots in background */ for( $i=0; $i<(140*40)/3; $i++ ) { imagefilledellipse($image, mt_rand(0,140), mt_rand(0,40), 1, 1, $gray); } for ($i = 0; $i < 5; $i++) { $x = $x + mt_rand(16, 24); $y = mt_rand(26, 32); $angle = mt_rand(-15, 15); $c = $ccolor[$i]; $fnt = mt_rand(0, sizeof($fontList) - 1); $colori = $rColors[$i]; imagettftext($image, mt_rand(20, 24), $angle, $x, $y, $colori, $fontList[$fnt], $cnum[$i]); } $digit = "$cnum[0]$cnum[1]$cnum[2]$cnum[3]$cnum[4]"; $_SESSION[$sitekey.'_digit'] = md5($sitekey.$digit); header("Expires: Tue, 11 Jun 1985 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header('Content-type: image/png'); imagepng($image); imagedestroy($image); exit( ); ?>