我想对printURL上的参数进行操作,就像这样(在本例中是Google):
我想得到它并像这样打印:
print("Go <a href='$url'>back</a> to the page you was before the login);
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
$div = explode("?", $_SERVER['REQUEST_URI'], 2);
$arg = end($div);
//like Sarfraz says, you can also use directly $_SERVER['QUERY_STRING']
echo sprintf(
'Go <a href="%s">back</a> to the page...',
htmlspecialchars(urldecode($arg), ENT_QUOTES));
Run Code Online (Sandbox Code Playgroud)
实际上,您需要验证要查看的URL
substr($url, 0, strlen($prefix)) === $prefix)是否足够; $url是urldecoded查询字符串)这些检查的原因是,否则攻击者可能会诱骗您的用户访问访问URL,这些访问URL虽然以您的域为前缀,但实际上会将其转发到受害者浏览器中的恶意网站或易受攻击的注册协议.
| 归档时间: |
|
| 查看次数: |
75 次 |
| 最近记录: |