All pastes #633654 Raw Edit

bleh

public php v1 · immutable
#633654 ·published 2007-07-25 21:27 UTC
rendered paste body
<?require ($_SERVER["DOCUMENT_ROOT"]."global.inc.php");if(!isset($_SESSION)) session_start();$captchalen=5;$captchax=rand(1,100);$captchay=rand(1,35);$captchastring="";$origin="";$charset=str_split("ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789");for($i=0; $i<$captchalen; $i++) {	$char=$charset[rand(0, (count($charset)-1))];	$captchastring.=$char." ";	$origin.=$char;}$_SESSION['CAPTCHA']=$origin;$im=imagecreate(200,50);$bg=array(rand(0, 128), rand(0, 128), rand(0, 128));$background=imagecolorallocate($im, $bg[0], $bg[1], $bg[2]);$textcolour=imagecolorallocate($im, rand(129, 255), rand(129, 255), rand(129, 255));drawduds($im, $bg[0], $bg[1], $bg[2], $charset);slash($im, 3);imagestring($im, 5, $captchax, $captchay, $captchastring, $textcolour);speckle($im, 100);slash($im, 3);imagerectangle($im, 0, 0, imagesx($im)-1, imagesy($im)-1, imagecolorallocate($im, 0, 0, 0));header("Content-Type: image/gif");imagegif($im);function speckle(&$im, $threshold) {	for($i=0; $i<$threshold; $i++) {		$pixelcolour=imagecolorallocate($im, rand(0,255), rand(0, 255), rand(0, 255));		imagesetpixel($im, rand(0, (imagesx($im)-1)), rand(0, (imagesy($im)-1)), $pixelcolour);	}}function slash(&$im, $threshold) {	for($i=0; $i<$threshold; $i++) {		$x=(imagesx($im)-1);		$y=(imagesy($im)-1);		$startx=rand(0, $x);		$starty=rand(0, $y);		$endx=rand(0, $x);		$endy=rand(0, $y);		$slashcolour=imagecolorallocate($im, rand(0,255), rand(0, 255), rand(0, 255));		imageline($im, $startx, $starty, $endx, $endy, $slashcolour);	}}function drawduds(&$im, $r, $g, $b, &$charset) {		$ghost=imagecolorallocate($im, $r, $g, $b);	for($i=0; $i<120; $i++) {		$rx=$r+rand(1,20);		$gx=$g+rand(1,20);		$bx=$b+rand(1,20);		imagechar($im, rand(1, 5), rand(0, imagesx($im)), rand(0, imagesy($im)), $charset[rand(0, (count($charset)-1))], imagecolorallocate($im, $rx, $gx, $bx));	}}ImagePNG($im);?>