NYCPHP Meetup

NYPHP.org

[nycphp-talk] including an & in a variable

CHUN-YIU LAM chun_lam at hotmail.com
Fri Jan 10 22:02:38 EST 2003


Look up commands:

htmlentities
htmlspecialchars
strtr


----Original Message Follows----
From: "Jaz-Michael King" <JMKing at ipro.org>
Reply-To: talk at nyphp.org
To: NYPHP Talk <talk at nyphp.org>
Subject: [nycphp-talk] including an & in a variable
Date: Thu,  9 Jan 2003 14:38:41 -0500
Received: from mc8-f9.law1.hotmail.com ([65.54.253.145]) by 
mc8-s17.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Thu, 9 Jan 
2003 11:49:09 -0800
Received: from parsec.nyphp.org ([66.250.131.26]) by mc8-f9.law1.hotmail.com 
with Microsoft SMTPSVC(5.0.2195.5600); Thu, 9 Jan 2003 11:49:08 -0800
Received: from nyphp.org (parsec.nyphp.org [66.250.131.26])by 
parsec.nyphp.org (8.12.6/8.12.6) with ESMTP id h09JcfSt037807;Thu, 9 Jan 
2003 14:38:41 -0500 (EST)(envelope-from listmaster at nyphp.org)
Message-Id: <200301091938.h09JcfSt037807 at parsec.nyphp.org>
X-Paralist-Archived: <http://nyphp.org/list/paralist_archive.php?L_mid=2206>
X-List-Software: Paralist 0.6
List-ID: <nyphptalk.nyphp.org>
List-Owner: <mailto:listmaster at nyphp.org>
List-Archive: <http://nyphp.org/list/paralist_archive.php?L_lid=1>
List-Subscribe: <http://nyphp.org/list/>
List-Unsubscribe: <http://nyphp.org/list/>
Organization: New York PHP
X-Mailer: Paramail 0.5
Return-Path: listmaster at nyphp.org
X-OriginalArrivalTime: 09 Jan 2003 19:49:08.0843 (UTC) 
FILETIME=[2CB2B3B0:01C2B818]

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


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus




More information about the talk mailing list