"Poe_Session")); $sess->register("securityCode"); $font = "fonts/arialbd.ttf"; $im = imagecreatefromjpeg("graphics/bg".rand(1, 3).".jpg"); $lead = strlen(md5("jimmybuffett")); $textstr = strrev(substr($_GET["code"],$lead,6)); //Create random size, angle, and dark color $size = 18; $angle = rand(-5, 5); $color = ImageColorAllocate($im, 255,255,255); //Determine text size, and use dimensions to generate x & y coordinates $textsize = imagettfbbox($size, $angle, $font, $textstr); $twidth = abs($textsize[2]-$textsize[0]); $theight = abs($textsize[5]-$textsize[3]); $x = 31; $y = 25; //Add text to image $arr = str_split('1234512345123451234512345123451234512345'); // get all the characters into an array shuffle($arr); // randomize the array $str = implode('', $arr); $slice = substr($str, rand(1,10), 13); // get the 13 random characters out for ($i=1;$i<=strlen($textstr);$i++) { $char = substr($textstr,($i-1),1); $angle = intval(substr($slice,$i,2)); $angle = rand(-40,40); if ($angle > 45) {$angle -= 25;} if ($i%2) {$x -= 15;} if ($char=="z" || $char=="Z" || $char=="n" || $char=="N") {$angle = 0;} $textsize = imagettfbbox($size, $angle, $font, $char); $twidth = abs($textsize[2]-$textsize[0]); //Add text to image ImageTTFText($im, $size, $angle, $x-1, $y-1, $shadow, $font, $char); ImageTTFText($im, $size, $angle, $x, $y-1, $shadow, $font, $char); ImageTTFText($im, $size, $angle, $x-1, $y, $shadow, $font, $char); ImageTTFText($im, $size, $angle, $x+1, $y+1, $shadow, $font, $char); ImageTTFText($im, $size, $angle, $x, $y, $color, $font, $char); $x += ($twidth+20); } //Output PNG Image header("Content-Type: image/jpeg"); imagejpeg($im); imagedestroy($im); //End Output exit; ?>