PHP Simple Verification Code
Length $i + +) {//cyclic random-fetch characters generate string $strnum. = $strings [rand (0, $count-1)];} Session_Start (); $_session ["verifycode"] = $strNum; $this->im = Imagecreate ($this->width, $this->height); $ BackgroundColor = Imagecolorallocate ($this->im, 255, 255, 255); Generate background color $framecolor = imagecolorallocate ($this->im, 0, 255, 0); for ($i = 0; $i < $this->length; $i + +) {$charY = ($this->height + 9)/2 + rand (-1, 1); Defines the character y coordinate $charx = $i * 15 + 8; Defines the character X coordinate//$text _color = imagecolorallocate ($this->im, 255, 0, 0); Generate character Color $text_color = Imagecolorallocate ($this->im, Mt_rand (255), Mt_rand (50, 2 ) $angle = rand (-20, 20); Generate character angle//write character imagettftext ($this->im, $this->fontsize, $angle, $charX, $charY, $text _color, $this->font, $ Strnum [$i]);} for ($i = 0; $i <= 5; $i + +) {//cycle draw background Line $linecolor = Imagecolorallocate ($this->im, Mt_rand (0, 255), Mt_rand (0, 255 ), Mt_rand (0, 255)); $linex = Mt_rand (1, $this->width-1); $liney = Mt_rand (1, $this->height-1); Imagelin E ($this->im, $linex, $liney, $linex + mt_rand (0, 4)-2, $liney + mt_rand (0, 4)-2, $linecolor);} for ($i = 0; $i <=; $i + +) {//cycle draw background points, create $pointcolor = Imagecolorallocate ($this->im, Mt_rand (0, 255), Mt_r and (0, 255), Mt_rand (0, 255)), Imagesetpixel ($this->im, Mt_rand (1, $this->width-1), Mt_rand (1, $this- >height-1), $pointcolor);} Imagerectangle ($this->im, 0, 0, $this->width-1, $this->height-1, $frameColor); Draw Border Ob_clean (); header (' content-type:image/png '); Imagepng ($this->im); Imagedestroy ($this->im);}} $img = new Verifyimg (); $img->build ();? >