Page 1 of 1

Need Help With Re-Direction

Posted: Tue Nov 04, 2003 11:31 pm
by gowni
Hello Friends,

I am have trouble with redirection.
To a file i am passing a url as parameter. It is working fine for some urls but for some urls its not re-directing properly. It gives File not found error, but when i type the url in the browser it works properly.
<?
$filename="Location: ".urldecode($_GET{url});
header($filename);
?>

example of url :
?url=http://www.qksrv.net/click-1167113-1027 ... D%3D334656'

thanks
heydude517

Posted: Tue Nov 04, 2003 11:42 pm
by markl999
I'm presuming that's a typo as you have 2 ?url= vars in there?

Its as it is

Posted: Wed Nov 05, 2003 12:53 am
by gowni
Hi friend,

The url it self is like that.

test.php?url=http://www.qksrv.net/click-1167113-1027 ... D%3D334656

the actual url to redirect also contains a variable called url.

thanks for help
heydude517

Posted: Wed Nov 05, 2003 1:31 am
by markl999
I'm still not sure why you are redirecting to a site that redirects you..why not just redirect straight to http://www.softwarenirvana.net ?

Re: Need Help With Re-Direction

Posted: Wed Nov 05, 2003 2:03 am
by m3mn0n
Try something like this:

Code: Select all

<?php
// old
$filename="Location: ".urldecode($_GET{url});
header($filename);

// new
$location = $_GET['url'];
$location = urldecode($location);
header ("Location: $location");
?>

Hi

Posted: Thu Nov 06, 2003 3:16 am
by gowni
Hi Friends,

I tried the above too, but its not working...

But when i write :

<?
$pieces=explode("=",$url);
$url1=$pieces[0]."=";
for($i=1;$i<count($pieces);$i++)
{
$url1.=urlencode($pieces[$i]);
if($i!=(count($pieces)-1))
{
$url1.=urlencode("=");
}
}
print "<script> window.location.href=\"$url1\"; </script>";
?>


Its working ...
But i want to konw why the Header("Location : $location "); didn't workout...

What was i missing ?? or something else went wrong?

Thanks