PHP: script to generate powerball numbers using php and gd

Here is the php script to generate your own powerball numbers using php and gd:
createimage.php

$pb_bg_image = imagecreate(380, 75)
      or die('Cannot Initialize new GD image stream');
$pb_bg = imagecolorallocate($pb_bg_image, 255, 255, 255);
$white = imagecolorallocate($pb_bg_image, 255, 255, 255);
$gray = imagecolorallocate($pb_bg_image, 185, 185, 185);
$red = imagecolorallocate($pb_bg_image,255,0,0);
$black = imagecolorallocate($pb_bg_image,255,50,50);
imagefilledarc($pb_bg_image, 28, 38, 58, 54,  0, 360, $gray,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 30, 38, 50, 50,  0, 360, $white,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 92, 38, 58, 54,  0, 360, $gray,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 94, 38, 50, 50,  0, 360, $white,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 156, 38, 58, 54,  0, 360, $gray,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 158, 38, 50, 50,  0, 360, $white,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 218, 38, 58, 54,  0, 360, $gray,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 220, 38, 50, 50,  0, 360, $white,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 280, 38, 58, 54,  0, 360, $gray,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 282, 38, 50, 50,  0, 360, $white,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 343, 38, 58, 54,  0, 360, $black,IMG_ARC_PIE);
imagefilledarc($pb_bg_image, 345, 38, 50, 50,  0, 360, $red,IMG_ARC_PIE);
#header ('Content-type: image/png');
imagepng($pb_bg_image);
imagedestroy($pb_bg_image);

number_generator.php

	</form>
<?php
	$pb = mt_rand(1,42);
	$wb1 = mt_rand(1,59);
	if($wb1 == 56){
		$wb1 = mt_rand(1,59);
	}
	$wb2 = mt_rand(1,59);
	$wb3 = mt_rand(1,59);
	$wb4 = mt_rand(1,59);
	if($wb4 == 57 || $wb4 == 58){
		$wb4 = mt_rand(1,59);
	}
	$wb5 = mt_rand(1,59);
	if($wb5 == 56){
		$wb5 = mt_rand(1,59);
	}

	?>
	</td></tr><tr><td>
	 <?php echo "<b>YOUR POWERBALL NUMBERS ARE:</b>
<table style='background-image:url(http://localhost/ebj/pbimage.php)
;text-align:center;font-weight:bold;font-size:1.5em' width=380px
 height=75px><tr><td width=54px >" . $wb1 . "</td><td width=54px>"
. $wb2 . "</td><td width=54px>" . $wb3 . "</td><td width=54px>" .
$wb4 . "</td><td width=54px>" . $wb5 . "</td><td style='color:white'
 width=54px>" . $pb . "</td></tr></table>"; ?>
	</td></tr><tr><td><br /><br />

See it in action at: Powerball Number Generator

Tags: , , ,

Comments are closed.