- Header ("Content-type:image/png");
- $num = $_get[' num '];
- $imagewidth = 60;
- $imageheight = 18;
- Srand (Microtime () * 100000);
- $numimage = Imagecreate ($imagewidth, $imageheight);
- Imagecolorallocate ($numimage, 183,180,83);
- for ($i =0; $i<>
- $font = Mt_rand (3,5);
- $x = Mt_rand (1,8) + $imagewidth * $i/4;
- $y = Mt_rand (1, $imageheight/3);
- $color =imagecolorallocate ($numimage, Mt_rand (0,50), Mt_rand (0,150), Mt_rand (0,255));
- Imagestring ($numimage, $font, $x, $y, $num [$i], $color);
- }
- Imagepng ($numimage);
- Imagedestroy ($numimage);
- ?>
- Call Method:
- Session_Start ();
- Include_once ' conn/conn.php ';
- $pattern = ' 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ ';
- $num = null;
- for ($i = 0; $i < 4; $i + +) {
- $num. = $pattern {Mt_rand (0, 61)};
- }
- ?>
- Verification Code:
- "Width=" height= "/>"
Copy Code
|
Verification code, write letter, PHP