开发者

URL lost during POST

开发者 https://www.devze.com 2023-03-22 00:38 出处:网络
What\'s wierd is that on one page I can echo a variable built by: $protocol = strpos(strtolower($_SERVER[\'SERVER_PROTOCOL\']),\'https开发者_运维问答\') === FALSE ? \'http\' : \'https\';

What's wierd is that on one page I can echo a variable built by:

$protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https开发者_运维问答') === FALSE ? 'http' : 'https';
$host     = $_SERVER['HTTP_HOST'];
$script   = $_SERVER['SCRIPT_NAME'];
$params   = $_SERVER['QUERY_STRING'];
$currentUrl = $protocol . '://' . $host . $script . '?' . $params;

Then post it to another page (I know the post works because I send other values):

<?php echo'<input type="hidden" name="Refferer" value="'.$currentUrl.'"/>'?>

But when I try to use it on my other page it is now empty:

$return = $_Post[Refferer];
header("Location: $return");

Anyone know what's happening to it?


$_POST is case sensitive.

Try to use $_POST instead of $_Post.


Try:

$return = $_POST['Refferer'];
header("Location: $return"); 


Try:

<?php echo '<input type="hidden" name="Refferer" value="'.urlencode($currentUrl).'"/>' ?>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号