我正在尝试重定向,但它不包含网址中的所有参数
if (!empty($_POST['nazwauzytkownika']) && $_POST['haslo'])
{
removed..
if (isset($_GET['redirect']))
$redirect = $_GET['redirect'];
else
$redirect = 'http://*****.pl/konto/?a=powitanie';
header("Location: $redirect");
}
如果$_GET[redirect]
包含http://localhost/forum/?p=thread&threadid=9
,则只会重定向到http://localhost/forum/?p=thread
答案 0 :(得分:0)
如果我理解你的问题,你正在寻找这样的事情:
if (isset($_GET['redirect']))
$redirect = substr($_GET['redirect'],0,strpos($_GET['redirect'],'&'));
您只传递查询字符串的第一个参数。
答案 1 :(得分:-1)
这不是重定向问题,而是网址问题 每个GET参数都应该是urlencoded
$redirect = rawurlencode($redirect);
?>
<a href="some.php?redirect=<?=$redirect?>">
然后您将使用重定向参数inact并可以将其用于重定向。
虽然它被认为是不好的做法,因为您的脚本可用于网络钓鱼链接。
最好只传递url标识符,然后从db / session /无论服务器端存储中读取url本身