What is the website Verification Code generally placed on the server? Why?

Source: Internet
Author: User
What is the website Verification Code generally placed on the server? Why? Are the website verification codes of javaphp.net stored in the same place? What is the website Verification Code generally placed on the server? Why? Are website verification codes made by java php. net stored in the same place?

Reply content:

What is the website Verification Code generally placed on the server? Why? Are website verification codes made by java php. net stored in the same place?

Verification CodeWhere on the server? Are languages the same?

First, I am not very familiar with the problem. I try to answer it through my understanding.

Verification Code-> captcha generation, must be inServerThe generated image is stored as an image on the serverA directory, These files can beGeneration TimeAfter a fixed period of timeAutomatic deletion.

I have also seen a fake verification code. The so-called fake verification code is generated and verified by js on the client side, rather than on the server side. Java php. net has a ready-made captcha generation method. You don't need to write it yourself. Just use it and configure the directory, Character Set, and captcha type.

If you have answered your question, please accept it, or click a like.

It usually exists in the session.

Simply put, when a verification code is generated, it is a random string. This variable is stored in the server memory in the form of a session, which corresponds to the session-id of the client, then, use the drawing method such as GDI + to draw an image and then output it to the page. The server does not save the image and only records the string for verification.

Generally, sessions are used. Default temporary files can be used, and sessions can be stored in the database or memory,

  1. Client Access website
  2. The server generates the Session tag and returns the Session tag to the client. This is generally achieved by outputting the tag in the Cookie in the response.
  3. The client carries the Session flag to access the verification code URL.
  4. The server generates random code and renders the random code into an image output. The Random Code (non-image) is stored in the memory and the data structure is generally a dictionary. You only need to maintain it easily.
  5. The client carries the Session flag to return the verification code entered by the user.
  6. The server searches for the previously generated random code in the dictionary based on the Session and compares it with the verification code returned by the client.

Have you seen it? The server does not save the verification code image. It only saves the verification code value in a short time. Because saving images does not make sense to the server, and it increases the IO and storage burden on the server.

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.