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,
- Client Access Web site
- The server generates the session tag and returns the session token to the client, typically through the output in the response in a cookie.
- The client carries the session tag to access the Verification Code URL
- 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.
- The client carries the session tag to return the user input verification code
- 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.