<?php

	// *****************************************************
	// *** COPYRIGHT DESIGNCONSULT - All rights reserved ***
	// *****************************************************
	
	$w = 75;
	$h = 40;
	$c = ((intval($_GET["c"]) / 15) - 2);
	
	header("Content-type: image/png");
	$image = imagecreatetruecolor($w, $h) or die("Cannot Initialize new GD image stream");
	
	$temp    = getrgb("#" . $_GET["bgcolor"]);
	$bgcolor = imagecolorallocate($image, $temp[0], $temp[1], $temp[2]);	
	$temp    = getrgb("#" . $_GET["color"]);
	$color   = imagecolorallocate($image, $temp[0], $temp[1], $temp[2]);	

	imagefilledrectangle ($image, 0, 0, $w, $h, $bgcolor);
	imagerectangle ($image, 0, 0, $w - 1, $h - 1, $color);
	
	$font = imageloadfont("password_font.gdf");
	imagestring($image, $font, 5, 5, $c, $color);

	imagepng($image);
	imagedestroy($image);
		

	function getrgb($color)
	{
		$chars = preg_split('//', $color, -1, PREG_SPLIT_NO_EMPTY);
		//split karaters
		$color = array();
		//maak array
		$char[0] = $chars[1].$chars[2];
		$char[1] = $chars[3].$chars[4];
		$char[2] = $chars[5].$chars[6];
		$color[0] = hexdec($char[0]);
		$color[1] = hexdec($char[1]);
		$color[2] = hexdec($char[2]);
		//berekend alles
		return $color;
	}	
	
	// ******************************************************
	// *** /COPYRIGHT DESIGNCONSULT - All rights reserved ***
	// ******************************************************
	
?>