How does PHP correctly generate cookies to ensure that the specified webpage is opened in a specific path? I have an image verification webpage verification. php, that is, login webpage. & nbsp; PHPcode & lt ;? Phpif (the entered image verification code is correct & amp; generate Cookie) {How does one generate a Cookie in PHP to ensure that the specified webpage is opened in a specific path?
I have an image verification webpage verification. php, that is, login webpage.
PHP code
There is also a data webpage data. php.
PHP code
I have been worried that some users will directly use the browser to log on to the data. php page, instead of logging on to the verification page verification. php.
How does PHP verify the Cookie generated by verification. php on the data webpage data. php? Note: it cannot be confused with cookies generated by other websites or other websites.
Is it necessary to use SHA1 to verify the Cookie?
------ Solution --------------------
Do you want to confuse the name of a cookie with other cookies?
Then you can define a complicated name. it doesn't matter if it is long.
------ Solution --------------------
If you directly log on to the data page using a browser, data. php does not have cookie variables.
If you are worried about cookie forgery, you can add a special token in the cookie and compare it with the cached value on the server.
------ Solution --------------------
In my previous projects, I used the session to store a login_flg field in it to identify the login status.
Make login_flg in php to determine whether there is no login and directly perform location jump to let him log on.
------ Solution --------------------
Only the server knows how to decrypt the encrypted data. for example, you can encrypt the data at the current time and resolve it to a time difference of less than 10 minutes.
------ Solution --------------------
Discussion
In my previous projects, I used the session to store a login_flg field in it to identify the login status.
Make login_flg in php to determine whether there is no login and directly perform location jump to let him log on.