Web Hosting Talk







View Full Version : header location playing up


saghir69
03-27-2005, 04:46 PM
Hi

I am using this code to send hits to other sites


header ('Location: '.$row['myurl'].'');



it works for links like http://www.funmansion.com/html/AOL-Preferences.html

but doesn't work for http://www.anyfun.net/show.phtml?type=pics&name=kid&num=2

its not even counting the clicks for these type of dynamic links

i think the problem is here

$sql = "SELECT myurl FROM table where myurl='".$site."'";

$site is a variable that is passed to this page through the url like this

http://www.are-you-bored.com/hitsout.php?site=http://www.anyfun.net/show.phtml?type=pics&name=kid&num=2

the database field myurl contains the same text as $site

but it don't think the script see's $site = myurl maybe because there are numbers in the string.


the myurl field type is tinytext in the mysql db


can someone help me with this?

maybe if i declare them both as plain text?

but i don't know how to do it so please help.

thanks

saghir69
03-27-2005, 04:59 PM
ok i used echo to see what the browser is passing as $site

and its http://www.anyfun.net/show.phtml?type=pics

but it should be http://www.anyfun.net/show.phtml?type=pics&name=kid&num=2

i tried 2 different links and its stoping on &

any ideas how i can fix that?

i hope you lot can under stand what i'm trying to explain

saghir69
03-27-2005, 06:18 PM
ok i know the problem now.

i didn't know what its called but anyway its Query String
and an "&" sign separates the variables

but i don't want '&' to act as a separator is that possible?

folsom
03-27-2005, 07:24 PM
Originally posted by saghir69
ok i know the problem now.

i didn't know what its called but anyway its Query String
and an "&" sign separates the variables

but i don't want '&' to act as a separator is that possible?

Maybe . . . you can try ; as a separator, but it may not work . . . www.w3.org/TR/html4/appendix/notes.html#h-B.2.2 (http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2)

saghir69
03-27-2005, 08:05 PM
folsom thanks for that, but i found a way around it. instead on sending the actual link as the query string, i'm just passing the id for the link . and thats working fine.

3yn
03-28-2005, 02:25 AM
use url_decode() and url_encode()