How to prevent users from entering a page manually? The root directory of the website contains the INDEX. PRIVATE. on the PHP page, I only allow it to be called by client programs and cannot be manually accessed by users (for example, 127.0.0.0private.php). how can I set it? ------ Solution ------------------ determine the source request address or obtain the last request address $ _ SERVER [how does HTTP prevent users from entering a page manually?
The root directory of the website contains the INDEX. PRIVATE. PHP page. Currently, I only allow it to be called by client programs and cannot be manually accessed by users (for example, http: // 127.0.0.0/private. php), how to set it?
------ Solution --------------------
Determine the source request address or obtain the last request address
$ _ SERVER ['http _ referer'];
If this is not the case, you can use js to implement it.
------ Solution --------------------
The optimal solution is $ _ SERVER ['http _ referer']; source monitoring
The other method is to set session permission authentication. a common user session jumps or returns 404 headers.
Users can use get or post parameters for authentication. it is also difficult for users who do not know the rules to make breakthroughs.
------ Solution --------------------
You don't have to use session.
You are in PRIVATE. Php also sets a variable.
For example
If ($ flag = 'value ')
...
Else
Exit ;...
When your client calls it, pass this value to this page to get its value.
You can set this value by yourself.
------ Solution --------------------
The client transmits encrypted data to the server for decryption and verification
I don't need to talk about the rest.
------ Solution --------------------
1. after the client is installed, generate your own public/private key and submit the GUID and public key through the custom protocol protected by HTTPS.
2. in the future, when the client connects to the server, the private key will be used to encrypt the GUID and then be submitted together with the GUID, the server selects the corresponding public key based on the GUID to decrypt and verify the GUID. if The GUID is successfully decrypted, the client is considered normal to issue the COOKIE used for SESSION.
In fact, the key is two points:
1. after the client is installed, the client connects to the server for the first time through HTTPS. if the server is considered to be fraudulent, the client can ask the CA to verify the certificate sent from the server. Otherwise, the client can directly trust the server certificate, the customer submits the customer's public/private key through the public/private key encryption and exchange of symmetric keys.
2. in fact, it is the configuration of the trust relationship under HTTPS protection. There should be several people who have played SCP/SSH.