NYCPHP Meetup

NYPHP.org

[nycphp-talk] including an & in a variable

Daniel Kushner nyphp at websapp.com
Thu Jan 9 15:02:51 EST 2003


http://www.php.net/manual/en/function.urlencode.php
http://www.php.net/manual/en/function.urldecode.php

--Daniel


> -----Original Message-----
> From: Jaz-Michael King [mailto:JMKing at ipro.org]
> Sent: Thursday, January 09, 2003 2:39 PM
> To: NYPHP Talk
> Subject: [nycphp-talk] including an & in a variable
> 
> 
> hi all
> 
> I'm trying to pass a bunch of long urls to a script as a link tracker
> but the urls contain ampersands. so, if I want to track the link
> www.domain.com?state=ny&county=kings
> 
> my script stops at the ampersand - I assume I have to escape it somehow?
> 
> if (!isset($redir)) 
>     die("Sorry, that link is bad. Please go back and try a 
> different link.");
> 
> if (!isset($referrer)) {
>     if (!isset($HTTP_REFERER)) {
>         $referrer = "none";
>     } else {
>         $referrer = $HTTP_REFERER;
>     };
> };
> 
> if (!isset($REMOTE_ADDR)) {
>     $remotehost = "no client address";
> } else {
>     $remotehost = $REMOTE_ADDR;
> };
> 
> $timeused = date("Y-m-d H:i:s",time());
> 
> @mysql_db_query($db_data , "insert into $db_table 
> values('$redir','$referrer',
>     '$remotehost','$timeused')");
> 
> Header("Location: $redir");
> exit;
> 
> thanks much,
> jaz
> 
> ******************************
> Jaz-Michael King
> Online Services Manager
> IPRO
> http://ipro.org
> ******************************
> 
> 
> 
> 
> 
> --- Unsubscribe at http://nyphp.org/list/ ---
> 



More information about the talk mailing list