【发布时间】:2009-07-31 08:03:49
【问题描述】:
我对在线网络应用程序真的很陌生。我正在使用php,我得到了这个代码:
if(isset($_GET['return']) && !empty($_GET['return'])){
return = $_GET['return'];
header("Location: ./index.php?" . $return);
} else {
header("Location: ./index.php");
}
$return 变量是 URL 变量,很容易被黑客更改。
例如,我从这里得到 $return 变量:www.web.com/verify.php?return=profile.php
有什么需要注意的吗?我应该在这一行中使用 htmlentities:
header("Location: ./index.php?" . htmlentities($return));
是否容易受到黑客的攻击?
我应该怎么做才能防止黑客入侵?
【问题讨论】:
标签: php security url variables