ASP Chinese character Chinese image Verification Code

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.