NYCPHP Meetup

NYPHP.org

including an & in a variable

Jaz-Michael King JMKing at ipro.org
Thu Jan 9 14:34:56 EST 2003


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
******************************






More information about the talk mailing list