Forum Moderators: coopster

Message Too Old, No Replies

header redirects messing up url

         

Doood

8:33 pm on Mar 10, 2008 (gmt 0)

10+ Year Member



I'm using some php code that generates a random url when you load the page, and then it redirects to that url via meta refresh. Even though it's set to refresh in zero seconds it still take a second or so. I need to get rid of the delay.

There is no output before or after the script so I used a header location redirect but it messes up the url.

Here's how it works,
You load the page and the script inserts a random "siteid" into the url. If echoed, the $string comes out like this,
[mysite...]

siteid# is the external site
zoneid# is so I can count the click

Lets say siteid=1913 is example.com
after being redirected to the site the url on that page shows,
http://example.com/?amp;zoneid=481
and the click is not counted because the zoneid somehow got stuck on the end of this url.

So does header location strip url's of question marks and ampersands or something? Using meta refresh never did that.

Is this not correct?

$string = $url;
header ("Location: $string");

Doood

10:09 pm on Mar 10, 2008 (gmt 0)

10+ Year Member



Well I tried removing the "amp;" and it works correctly.

All I did was add this,

$string=str_replace("amp;","", $string);

Hopefully that doesn't create any extra load or something.