Jump to content

URL Passthru


holyearth

Recommended Posts

Hello,

I'm trying to pass a url thru for redirection....example....

http://www.example.com/index.php?r=http://www.google.com

I must pass it thru that way...

Here's my code but it's not working....

[code]<?php

$data = urlencode($HTTP_GET_VARS['r']);

?>


<HTML><HEAD>
<META HTTP-EQUIV=Refresh CONTENT="0; URL=<? echo("$data"); ?>">
</HEAD></HTML>[/code]


I think the urlencode is wrong??

Please help. Thanks in advance!
Link to comment
https://forums.phpfreaks.com/topic/31253-url-passthru/
Share on other sites

if you echo it you will se that it's transformed to [color=red]http%3A%2F%2Fwww.google.com[/color]

try [color=blue]$data = htmlspecialchars($_GET['r']);[/color] instead, and if there is no particular reason, quit the habit of using older predefined variables ($HTTP_*_VARS) and start using $_GET, $_POST etc. instead.
Link to comment
https://forums.phpfreaks.com/topic/31253-url-passthru/#findComment-144593
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.