How to Encrypt the URL

前端 未结 3 1415
时光取名叫无心
时光取名叫无心 2020-12-11 14:07

I want to know how to encrypt the URL on Apache/PHP?

For example:

www.example.com/how-to-encrypt.html

to

3条回答
  •  时光说笑
    2020-12-11 14:51

    It's best to perform security operations at the database level. Here is how to perform MySQL database operations using PHP: PHP Database Operations with MySQL. Then, you have access to all of the database operations related to security, such as: Encryption and Compression Functions. Thus, you can generate the string in the database and pass a token in a URL parameter to the user. It is best to also pass another parameter, such as a username, into the URL to reduce security risk. Upon client response, you just grab the parameters from the url and validate the user. Be sure to sanitize and validate input before performing the database operation. Sanitize and validate before assuming data is safe.

    And for information, you should never use JavaScript to perform important security operations, at least not without seriously evaluating the risks and alternative options. (Any hacker will see your entire security logic in the JavaScript code.)

    Notice that you can grab the _ylt & _ylu parameters from this url:

    • us.yahoo.com/_ylt=As6pPqj3t7OBn2LQbZCUU7abvZx4;_ylu=X3oDMTVocThw330824863

    Those parameters are what you will grab for your database operation. You could use these in a particular page like this:

    • us.yahoo.com/myPage/_ylt=As6pPqj3t7OBn2LQbZCUU7abvZx4;_ylu=X3oDMTVocThw330824863

提交回复
热议问题