使用 PHP 在两个页面之间传递变量的最安全方法 [英] Most secure way to pass variables between two pages with PHP

查看:31
本文介绍了使用 PHP 在两个页面之间传递变量的最安全方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种以安全方式在两个页面之间传递变量的方法.

I need a way to pass a variable between two page in a secure way.

我知道我可以使用 POST/GET/Cookie/Session 或隐藏字段,但我认为这些方法都不够安全,因为:

I know that I can use POST / GET / Cookie / Session or hidden fields but I think none of these ways aren't secure enough because :

在url中可以看到get
cookie 是客户端,因此可以从客户端进行更改
session 可以面对 Session ID 劫持和...

get can be seen in the url
cookies is a client side so it can be change from client
session can confront Session ID hijacking and ...

现在我想知道有没有比这些方法更好的方法,如果没有这些方法,那么以安全方式传递变量的最佳方法是;

Now I want to know is there another ways better than these ways and if there isn't witch of these is the best way to pass variables in secure manner;

推荐答案

Session 是您可用的最安全的方法.

Session is the most secure method you have available.

会话 ID 重新生成将有助于防止会话劫持,但通过 https 的 SSL 确实可以防止它.

Session id regeneration will help against session hijacking, but SSL via https will really protect against it.

顺便说一句:如果会话被劫持并且您正在向客户端显示用户数据,那么无论您如何将数据获取到第二页,劫持者都会看到它.如果你只在服务器端使用它,劫持者是看不到它的.

BTW: If the session is hijacked and you're displaying user data to the client, it doesn't matter how you got the data to the second page, the hijacker will see it. If you're only using it server side, the hijacker won't see it.

这篇关于使用 PHP 在两个页面之间传递变量的最安全方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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