For PHP login page verification code implementation, open Dreamweaver cs6 and create a PHP site:
Create a new file named 111. php and double-click edit to clear the HTML code automatically generated by Dreamweaver, as shown below;
Add the PHP code in the Dreamweaver CS6 editor as follows:
Session_start ();
Header ("Content-Type: image/png"); // Set the header information of the page to png image $ im = imagecreate (60, 20); // Create a canvas
$ Im_color = imagecolorallocate ($ im, 100,100,100); // fill in the verification code. The background is gray.
For ($ I = 0; $ I <4; $ I ++)
{
$ Line_color = imagecolorallocate ($ im, rand (0,255), rand (0,255), rand (0,255 ));
Imageline ($ im, rand (), $ line_color );
}
// Draw four random interference lines in a practical cycle
$ N = rand );
$ _ SESSION ["y"] = $ n;
$ P = 0;
For ($ I = 0; $ I <4; $ I ++)
{
$ P = $ p + 10;
$ Num = substr ($ n, $ I, 1); // Obtain the verification code numbers one by one.
$ Num_color = imagecolorallocate ($ instant, rand (0,255), rand (0,255), rand (0,255 ));
Imagettftext ($ im, rand (10, 15), rand (-10, 10), $ p, rand (10, 15), $ num_color, "font1.ttf", $ num );
}
// Set the color, angle deviation, and font of each verification code number.
Imagepng ($ im); // output the verification code
Imagedestroy ($ im); // release memory
?>
Then,
Create a login. php file;
The nickname of the username text box is name;
The password text box is; you can write it as needed
The verification code is. you can write it as needed.
Form submission method is post and submitted to check. php.
End