Forum Moderators: coopster
What I'm trying to do now is add some code to the page they're being redirected to to see if specific strings (image names) are in the referer URL so that I can redirect them to the appropriate page with that image. I know the part of the code that finds the string works but when I add a redirect to it, the redirect process slows to a crawl and if it ever does redirect, the browser shows the contents of my "home" directory (!) I removed the frame-busing script in case that was the problem but I'm having the same problem.
$string = 'foo.jpg';
$refererurl = $_SERVER[HTTP_REFERER];
$position = strpos($refererurl, $string);
if ($position === false)
{
}
else Header("Location: http://www.example.com/foo.jpg");
Update: Now the problem is that the redirect works but if I try to use something like, "?image=foo.jpg" it doesn't work (or, to be more specific in my case,?i=3 which is a reference to an article number in the databse). I'm guessing that there's some problem making a database call or using a variable like that inside a header redirect (?)
TIA
[edited by: coopster at 9:58 pm (utc) on Dec. 22, 2004]
[edit reason] generalized url [/edit]