At present, many websites in order to prevent users to use robot automatic registration, login, irrigation, have adopted
Verification code technology. The so-called verification code, is a string of randomly generated numbers or symbols to generate a picture,
The image with a number of interference pixels (to prevent OCR), by the user's eyes to identify the authentication code information, the loss
Submit a Web site validation to the form and verify that you are successful before you can use a feature.
English Learning Network We have shown here how to write PHP program implementation Verification code function:
Code One:
CODE:
<?php
/*
* Filename:authpage.php
* Author:hutuworm
* date:2003-04-28
* @Copyleft hutuworm.org
*/
Srand (Double) microtime () *1000000);
Verify that user input is consistent with the authentication code
if (isset ($HTTP _post_vars[' authinput '])
{
if (strcmp ($HTTP _post_vars[' Authnum '], $HTTP _post_vars[' authinput ']) ==0)
echo "Validation successful! ";
Else
echo "Validation failed! ";
}
To generate a new four-bit integer verification code
while (($authnum =rand ()%10000) <1000);
?>
<form action=authpage.php method=post>
<table>
Please enter the verification code: <input type=text name=authinput style= "width:80px" ><br><input type=submit "name=" Verify "value=" Submit Verification Code ">
<input Type=hidden name=authnum value=<? Echo $authnum;?