Usage:
Insert where you want to display the verification code Image
Code
At the same time, the session ("PSN") is automatically generated, and the form is submitted to verify the session.
According to the comments, there are still some questions about the correct use of the Verification Code. Here I will write a simple example:
Press OK:
<%
'Determine whether the OK button is pressed. If yes, check whether the verification code is entered correctly.
If request. querystring ("Submit") <> "then
Dim checkcode
Checkcode = trim (request. querystring ("checkcode "))
If checkcode = SESSION ("PSN") then
Response. Write ("<SCRIPT> alert ('verification code right'); </SCRIPT> ")
Else
Response. Write ("<SCRIPT> alert ('verification code error'); </SCRIPT> ")
End if
End if
%>
<Form action = "test. asp" method = "get">
<Input type = "text" name = "checkcode"/>
<Input type = "Submit" name = "Submit" value = "OK">
</Form>
Communicate with netizens and find that they use this method during testing:
<% = SESSION ("PSN") %>
The results are displayed with different two characters each time, so there is a question! This session ("PSN") obtains the previous generated session. My capabilities are limited. I can only explain this as follows:
<% = SESSION ("PSN") %>
when the two statements are executed, a session ("PSN") is generated when the first statement is executed, but the generated speed is better than the output SESSION ("PSN") below ") fast? The answer is no. To generate a session, you can check the code in code. asp. Therefore, the session in the second sentence is retained by the previous session. You can try the first execution and the second sentence is actually nothing output. However, in my example, there is enough situation to change the session value. I understand it in this way. If you have any problems, please do not hesitate to give me some advice!
package and download files