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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.