Where does the site verification code usually be placed on the server side? Why?

Source: Internet
Author: User
Tags server memory
Where does the site verification code usually be placed on the server side? Why? Does the Java PHP. NET website Verification code be put in the same place?

Reply content:

Where does the site verification code usually be placed on the server side? Why? Does the Java PHP. NET website Verification code be put in the same place?

Where is the verification code placed on the server? Is it the same place in every language?

First of all, I'm not quite able to understand, I try to answer through my understanding

Verification code--Captcha generation, is bound to be 服务器端 generated, will be stored as a picture placed under the server 一个目录 , these files can be 生成时间 named and then fixed after a period of time 自动删除 .

I've seen people do fake verification code, the so-called fake verification code is in the client side with JS generation verification, rather than to the server side to verify. Java PHP. NET has a ready-made captcha generation method, do not write their own, directly with the line, configure the directory, the character set and the captcha type is OK.

如果回答了您的问题请采纳吧,或者点个赞也行啊

It's usually there in the session.

To put it simply, when the code is generated, Mr. Session-id into a random string, which is stored in the server memory as a session, corresponds to the client, and then plotted as a picture using GDI +, and then output to the page, the server does not save the picture only the record string is used to verify

Usually use the session, you can use the default temporary files, but also put the session in the database or memory,

    1. Client Access Web site
    2. The server generates the session tag and returns the session token to the client, typically through the output in the response in a cookie.
    3. The client carries the session tag to access the Verification Code URL
    4. The server generates random code and renders the random code as a picture output, a random code (not a picture) stored with the data structure in memory, usually a dictionary, as long as the maintenance is easy to lose line.
    5. The client carries the session tag to return the user input verification code
    6. The server uses a dictionary to find the random code generated before the session and compares it with the verification code returned by the client.

Did you see it? The service side does not save the verification code picture, only in a short period of time to save the value of the verification code. Because saving a picture doesn't make sense to the server, it increases the server's IO and storage burden.

  • 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.