Location: PHPKode > projects > Site Sift Listings > include/classes.php
<?php
class securityImage{
	var $numChars    = 5;  // Length of string: max 10;
	var $width       = 100;// Image Width
	var $height      = 20; // Image height: default 15;
	var $colorBG     = "132 194 37"; //bg color
	var $colorText   = "12 77 147";  //text color
	var $colorBorder = "12 77 147";  //border color
	var $charSpacing = 16; // character spacing
	
	function securityImage(){
		session_start();
	}
	function makeString(){
		$md5 = md5(mt_rand(0,99999));
		$text = substr($md5, 5, 5);
		return $text;
	}
	function getText(){
		$this->text = $this->makeString();
		$_SESSION['codeS'] = $this->text;
	}
	function getColor($var){
		$rgb = explode(" ",$var);
		$color = imagecolorallocate ($this->image, $rgb[0], $rgb[1], $rgb[2]);
		return $color;
	}
	function showImage(){
		$this->makeImage();	
		header("Content-type: image/png");
		imagegif($this->image);
		imagedestroy($this->image);
	}
	function makeImage(){
		$this->image = imagecreatetruecolor($this->width, $this->height); 
		imagefill($this->image, 0, 0, $this->getColor($this->colorBorder));
		imagefilledrectangle ($this->image, 1, 1, ($this->width-2), ($this->height-2), $this->getColor($this->colorBG));
		imageline($this->image, -20, 1, 25, 20, $this->getColor($this->colorBorder));
		imageline($this->image, 5, 1, 50, 20, $this->getColor($this->colorBorder));
		imageline($this->image, 40, 1, 75, 20, $this->getColor($this->colorBorder));
		imageline($this->image, 60, 1, 95, 20, $this->getColor($this->colorBorder));
		imageline($this->image, 80, 1, 125, 20, $this->getColor($this->colorBorder));
		imagestring($this->image, 5, 30, 3, $this->text, $this->getColor($this->colorText));
	}
} 
?>
Return current item: Site Sift Listings