All pastes #469330 Raw Edit

henke37

public php v1 · immutable
·published 2007-05-03 17:48 UTC
rendered paste body
<?phpheader("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the pastif(!isset($_GET['demo'])) { require dirname(__FILE__).'/init.php';//inits the session $demo=false;} else { $demo=true;}$xsize=200;$ysize=50;$gd= imagecreatetruecolor($xsize,$ysize+($demo?20:0));$bgcolor=imagecolorallocatealpha( $gd, rand(220,255), rand(220,255), rand(220,255), 0);imagefilledrectangle( $gd, 0, 0, $xsize, $ysize+($demo?20:0), $bgcolor);//draw crap letters in bgfor($i=rand(8,11);$i>0;--$i) {	$size	= rand(10, 16);	$angle	= rand(-31,35);	$x		= intval(rand(0, $xsize));	$y		= intval(rand(0, $ysize - $size/5 ));	$color	= imagecolorallocatealpha(  $gd,  rand(150,170),  rand(150,170),  rand(150,170),  rand(75,90) );	$text	= substr('ABCDEFGHIJKLMNOPQRSTUVXYZ0123456789',rand(0,36),1);	//echo $text;	ImageTTFText($gd, $size, $angle, $x, $y, $color, 'fonts/FORTE.TTF', $text);}//echo '<br>';$text='';$letters='ABDFHJKMNOPQRSUVXY123456789';for($i=rand(10,11);$i>0;--$i) {	$size	= rand(14, 16);	$angle	= rand(-10,15);	$x	= min(max($xsize-($i*18+rand(0,5)),0),$xsize-16);	$y		=  rand($ysize *0.4,$ysize *0.6 ); //echo "$y,";	$color	= imagecolorallocatealpha(  $gd,  rand(150,180),  rand(150,180),  rand(150,180),  rand(2,13) );	$t	= substr($letters,rand(0,strlen($letters)),1);	//echo $t;	ImageTTFText($gd, $size, $angle, $x, $y, $color, 'fonts/FORTE.TTF', $t);	$text.=$t;}if(!$demo) { $_SESSION['captcha']=$text;} else { $color	= imagecolorallocatealpha(  $gd,  0,  0,  0,  0 ); imagettftext($gd,15,0,0,$ysize+20,$color,'fonts/arial.ttf',$text);} header('Content-type: image/png');imagepng($gd);