NYCPHP Meetup

NYPHP.org

[nycphp-talk] including an & in a variable

CHUN-YIU LAM chun_lam at hotmail.com
Fri Jan 10 23:57:57 EST 2003


you don't have to use all 3 commands, just pick the one that will suit your 
needs.

Matthew




----Original Message Follows----
From: "Phil Powell" <soazine at erols.com>
Reply-To: talk at nyphp.org
To: NYPHP Talk <talk at nyphp.org>
Subject: Re: [nycphp-talk] including an & in a variable
Date: Fri, 10 Jan 2003 22:22:59 -0500
Received: from mc8-f32.law1.hotmail.com ([65.54.253.168]) by 
mc8-s1.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Fri, 10 Jan 
2003 19:27:53 -0800
Received: from parsec.nyphp.org ([66.250.131.26]) by 
mc8-f32.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Fri, 10 Jan 
2003 19:27:52 -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 h0B3Mxv6048843;Fri, 10 Jan 
2003 22:23:03 -0500 (EST)(envelope-from listmaster at nyphp.org)
Message-Id: <200301110323.h0B3Mxv6048843 at parsec.nyphp.org>
X-Paralist-Archived: <http://nyphp.org/list/paralist_archive.php?L_mid=2241>
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: 11 Jan 2003 03:27:52.0708 (UTC) 
FILETIME=[6C9CF440:01C2B921]

In the links you would want to wrap them around the htmlentities() function
that returns an HTML-escaped string.  I'm not sure about htmlspecialchars()
though..

Phil

----- Original Message -----
From: "Jaz-Michael King" <JMKing at ipro.org>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Thursday, January 09, 2003 3:35 PM
Subject: RE: [nycphp-talk] including an & in a variable


 > So right now I have to point to dozens of pages like thi sone:
 >
http://www.medicare.gov/NHCompare/Search/HomeSelect.asp?State=NY1%7CNew+York
+-+Upstate&Type=County&County=33060%7CChautauqua
 >
 > So I use
 >
 >
href="http://www.ipro.org/redirect.php?redir=http://www.medicare.gov/NHCompa
re/Search/HomeSelect.asp?State=NY1%7CNew+York+-+Upstate&Type=County&County=3
3060%7CChautauqua"
 >
 > which counts the click and forwards the user (except for stopping at
"&Upstate")
 >
 > but you're saying now I would need
 > <?
 > $redir =
'http://www.medicare.gov/NHCompare/Search/HomeSelect.asp?State=NY1%7CNew+Yor
k+-+Upstate&Type=County&County=33060%7CChautauqua'
 > ?>
 > ..
 > href="http://www.ipro.org/redirect.php?redir=<?= urlencode($redir) ?>"
 > ..
 >
 > for each link?
 >
 >
 > >>> sklar at sklar.com 01/09/03 03:02PM >>>
 > Use urlencode() to encode the URLs being passed to the link tracker.
 >
 > E.g. do this:
 >
 > $redir = 'http://www.domain.com?state=ny&county=kings';
 > print '<a href="'.urlencode($redir).'">click here</a>.';
 >
 > Instead of this:
 >
 > $redir = 'http://www.domain.com?state=ny&county=kings';
 > print '<a href="'.$redir.'">click here</a>.';
 >
 >
 > -dave
 >
 >
 > > -----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/ ---


_________________________________________________________________
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