Reputation: 157
Im trying to pass a link with contains a full url;
http://xxx.co.uk/trackit.php?page=http://xxx.co.uk/game?p=buildings&menu
As you can see in the link above, first it goes to a script called trackit, does some tracking then redirects to the actual page i want, however in this case the '&menu' is being removed, i think i understand why, but have been unable to fix it.
$next_page = mysqli_real_escape_string($con, $_GET['page']);
header("Location: $next_page");
Any advise would be great. Thanks
Upvotes: 1
Views: 113
Reputation: 30
//before display your url
$page = urlencode('http://xxx.co.uk/game?p=buildings&menu');
$url = 'http://xxx.co.uk/trackit.php?page=' . $page;
echo $url;
// displays
// http://xxx.co.uk/trackit.php?page=http%3A%2F%2Fxxx.co.uk%2Fgame%3Fp%3Dbuildings%26menu
//when you receive it on the get
$next_page = urldecode($_GET['page']);
header("Location: $next_page");
Upvotes: 1