rendered paste body<?php if ( !$_GET['created'] ){ echo <<< EOHTML <style type="text/css"> input,input.btn{ color:#050; font-family:'trebuchet ms',helvetica,sans-serif; font-size:84%; font-weight:bold; background-color:#fed; border:1px solid; border-top-color:#696; border-left-color:#696; border-right-color:#363; border-bottom-color:#363;} </style> <form action="gradient.php"> <fieldset><legend>create a gradient</legend> left color: # <input type="text" size="7" maxlength="6" name="left" id="" value=""/><br> right color: # <input type="text" size="7" maxlength="6" name="right" id="" value=""/><br> width: <input type="text" size="4" maxlength="4" name="width" id="" value=""/><br> height: <input type="text" size="4" maxlength="4" name="height" id="" value=""/><br> <input type="hidden" name="created" value="1"/> <input class="btn" type="submit" value="create"/> </fieldset> </form>EOHTML; exit; } $leftR = hexdec(substr($_GET["left"],0,2)); $leftG = hexdec(substr($_GET["left"],2,2)); $leftB = hexdec(substr($_GET["left"],4,2)); $rightR = hexdec(substr($_GET["right"],0,2)); $rightG = hexdec(substr($_GET["right"],2,2)); $rightB = hexdec(substr($_GET["right"],4,2)); $image=imagecreate($_GET["width"],$_GET["height"]); for($i=0;$i<250;$i++) { $colorset[$i] = imagecolorallocate($image, $leftR + ($i*(($rightR-$leftR)/250)), $leftG + ($i*(($rightG-$leftG)/250)), $leftB + ($i*(($rightB-$leftB)/250))); } for ($y=0;$y<$_GET['height'];$y++){ for($x=0;$x<($_GET["width"]);$x++) { imagesetpixel ($image, $x, $y, $colorset[(int)($x/($_GET["width"]/250))] ); } } header("Content-type: image/png"); imagepng($image); imagedestroy($image);?><?PHP $captchastringarray=array_fill(0, 5, rand(65, 90)); // Generate array of ASCII values from 65 to 90 $captchastring=""; // Create a placeholder variable for the string foreach($captchastringarray as $character) { // For every ASCII value in the array $captchastring.=chr($character); // Add the character onto the string } $XSIZE=200; // Width of the image $YSIZE=100; // Height of the image $im=imagecreate($XSIZE,$YSIZE); // Create a 200x100 image $white=imagecolorallocate($im, 255, 255, 255); // Allocated the index for black $black=imagecolorallocate($im, 0, 0, 0); // Allocated the index for black imagestring($im, 3, 0, 0, $captchastring, $black); // Write the CAPTCHA string in black at (0,0) // header("Content-Type: image/jpeg"); imagepng($im); imagedestroy($im);?>