如何加密URL [英] How to Encrypt the URL

查看:142
本文介绍了如何加密URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何加密Apache / PHP上的URL?

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

例如:


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

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


www.example.com/DMQRzZWMDdGQtbndzBHNsawN0aXRsZQR0ZXN0AzcwMQR3b2UDMjQwMjEwNQ

www.example.com/DMQRzZWMDdGQtbndzBHNsawN0aXRsZQR0ZXN0AzcwMQR3b2UDMjQwMjEwNQ

此示例也看到在yahoo以及这个链接:

This example also seen on yahoo as well like this link:


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

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

我想知道这样做,是通过JavaScript / PHP / Apache吗?

I want to know how to do like this, is it through JavaScript/PHP/Apache?

推荐答案

最好在数据库级别执行安全操作。以下是如何使用PHP执行MySQL数据库操作:使用MySQL的PHP​​数据库操作。然后,您可以访问与安全性相关的所有数据库操作,例如:加密和压缩函数。因此,您可以在数据库中生成字符串,并将URL参数中的令牌传递给用户。最好还将一个参数(如用户名)传递到URL中以降低安全风险。在客户端响应时,您只需从URL获取参数并验证用户。在执行数据库操作之前,请务必对输入进行清理和验证。 在假定数据安全之前进行消毒和验证。

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.

对于信息,您绝对不应该使用JavaScript来执行重要的安全操作,至少没有认真评估风险和替代选项。 (任何黑客会在JavaScript代码中看到您的整个安全逻辑。)

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.)

请注意,您可以抓取_ylt& _ylu参数来自此网址:

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

这篇关于如何加密URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆