In order to deal with the violent crack login password, the input verification code is employed in the user registration or logging in. There are many ways to generate a verification code, and only the ideas and implementation methods of generating digital verification codes are introduced. (The following programming language is VBS) Digital verification code is typically generated by random numbers, or by time generation, such as separate score, second, milliseconds, but the author believes that its security is not the former.
1, the generator of the verification code (using a random number) [filename]: getverifycode.asp [code]: <% DIM getrandom = MID ((RND * 100000), 1, 4) 'Generate 6 The number of randhes, the 4-bit session ("verifycode") = GetrandOM 'is saved in the session%> Use the file to nescery to the page to display the verification code. The effect of depositing the generated verification code in the session is that after submitting the data, the value of the verification page reads the user input is compared to the value. If the anastomosis proves that its data source is legal, the next step can be performed.
2, after the generating program of the verification code is generated, it can be displayed by two methods, one is to display directly, and the other is the picture display. The following focuses on the image display method. First we have to use the drawing software to produce a total of 10 pictures of 0 ~ 9, respectively, named 1.gif, 2.gif ..., and so on. After the production is completed, we can start writing code. The code is as follows: [code]: . Gif" width = "15" Height = "15" alt = ">> . GIF" width = "15" Height = "15" alt = "> . GIF "width =" 15 "Height =" 15 "alt ="> . GIF "width =" 15 "height =" 15 "alt =" "> At the same time, we must insert a verification code input box in the form so that the user can follow the verification code as shown. Enter.
3. Verify that the verification code enters the verification code and other necessary information. After the submission, the corresponding verification process is to be performed in the received data page. The process is relatively simple, just compare the user input verification code to the SESSION. The code is as follows: [CODE]: DIM Usercode Usercode = Request.form ("Verify") IF UserCode <> SESSION ("VerifyCode") THEN Response.Redirect ("Verification Code Incorrect Tips Page") Response.end Else Data) END IF to this, a simple verification code is completed. This article has an error and deficiencies, please refer to it.