RE: [PHP] Question: urldecode

2004-12-09 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
 Sent: 09 December 2004 11:52
 
 In my search page, the url returned comes back with
 the ..err I forget what it's called, but query string
 looks like this: %5B%5D=3.  I think the %5B and 5D
 should be [].

Are you seeing the URL-encoded version *only* in your browser's
Address/Location bar?  If so, that's perfectly normal and nothing to worry
about -- it should be automatically decoded by the Web server before being
passed to PHP.

If you're seeing the encoded version actually in your PHP script, that
sounds like a major problem, possibly indicating a missing urldecode() or
extraneous urlencode() -- in which case, please post a more detailed
analysis of your problem, examples of the unwanted behaviour, and the
relevant portions of script.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Question: urldecode

2004-12-09 Thread Stuart Felenstein

--- Ford, Mike [EMAIL PROTECTED] wrote:

 Are you seeing the URL-encoded version *only* in
 your browser's
 Address/Location bar?  If so, that's perfectly
 normal and nothing to worry
 about -- it should be automatically decoded by the
 Web server before being
 passed to PHP.

 
 If you're seeing the encoded version actually in
 your PHP script, that
 sounds like a major problem, possibly indicating a
 missing urldecode() or
 extraneous urlencode() -- in which case, please post
 a more detailed
 analysis of your problem, examples of the unwanted
 behaviour, and the
 relevant portions of script.
 
I have no idea about what it means to see the encoded
version in my script. I have only one urldecode in the
script:

a href=SearchJobDetails.php?JobID=?php echo
urldecode($row_rsVJ['JobID']);?

No urlencodes anywhere. 
I'll assume it's decoded properly before going to php
because the script runs fine.  I just know that I've
seen the hex's normally converted in the browser bar.

Further, I was assuming I should add the urldecode to
the query string.  As I had posted originally.  From
the example in the manual it appears I might to pass
the params through a urldecode counter loop.  

Lastly, I wasn't concerned about the hex code, but I
just made some reconnections of scripts.  Users can
save their search parameters.  I am saving the query
string.  Now I had this set up before and the way it
was working , is when the user wanted to view or
edit their saved searches, the search page would come
back with all the parameters filled in including
shaded parameters in things like mult select lists and
menu dropdowns.  It's not working that way now , so my
first suspicion is perhaps the hex is effecting it.

I can post more of the script if that makes sense.

Stuart

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Question: urldecode

2004-12-09 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



 -Original Message-
 From: Stuart Felenstein [mailto:[EMAIL PROTECTED] 
 Sent: 09 December 2004 13:38
 
 --- Ford, Mike [EMAIL PROTECTED] wrote:
 
  Are you seeing the URL-encoded version *only* in
  your browser's
  Address/Location bar?  If so, that's perfectly
  normal and nothing to worry
  about -- it should be automatically decoded by the
  Web server before being
  passed to PHP.
 
  
  If you're seeing the encoded version actually in
  your PHP script, that
  sounds like a major problem, possibly indicating a
  missing urldecode() or
  extraneous urlencode() -- in which case, please post
  a more detailed
  analysis of your problem, examples of the unwanted
  behaviour, and the
  relevant portions of script.
  
 I have no idea about what it means to see the encoded
 version in my script. I have only one urldecode in the
 script:
 
 a href=SearchJobDetails.php?JobID=?php echo 
 urldecode($row_rsVJ['JobID']);?

I actually doubt whether you even need this urldecode() -- but it depends
where that value is coming from.

 Further, I was assuming I should add the urldecode to
 the query string.

I don't quite understand this -- if you mean the query string supplied to
your script and manifesting in your $_GET array, then no, very unlikely,
since this should have been taken care of by the Web server before it gets
anywhere near PHP.  If you're referring to echoing out URLs with query
strings on them, then that is one of the few instances where urlENcode()
might be necessary, but definitely not urlDEcode().

 Lastly, I wasn't concerned about the hex code, but I
 just made some reconnections of scripts.  Users can
 save their search parameters.  I am saving the query
 string.  Now I had this set up before and the way it
 was working , is when the user wanted to view or
 edit their saved searches, the search page would come
 back with all the parameters filled in including
 shaded parameters in things like mult select lists and
 menu dropdowns.  It's not working that way now , so my
 first suspicion is perhaps the hex is effecting it.

All I can say to this is to re-iterate the point that your Web server should
be decoding those %xx values before your script ever gets to see them.  You
*may* have to urlencode() values you write out that might one day form part
of a clickable link -- but, because of the previous sentence, you should not
yourself need to do the compensating urldecode() in the target script.

Once again, this sounds like a situation where you need to be echoing out
everything and anything of even the slightest relevance at the crucial spots
of your script -- in the debugging phase, my scripts often have a bunch of
debugging echoes every few lines, and some sections even end up with more
temporary echoes than actual script!  It's tedious wading your way through
the screenfuls of output, but can be exceedingly illuminating of an elusive
problem.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question: urldecode

2004-12-09 Thread Richard Lynch
Stuart Felenstein wrote:
 In my search page, the url returned comes back with
 the ..err I forget what it's called, but query string
 looks like this: %5B%5D=3.  I think the %5B and 5D
 should be [].

 What I think is needed is rawurldecode.  I've looked
 through my code and think it belongs somewhere in this
 block:

Don't guess.

Figure out *EXACTLY* where and when the URL is being encoded to Hex --
where it first appears in your scripts/database/application as %5B.

Decide if it's right for it to be in Hex at that point.


If it's not right for it to be Hex at that point, change it there.

You'll drive yourself crazy changing it here, where it's already in the
system in a format you don't want.

My *GUESS* is that you're taking the QUERY string and stuffing it into
your database.

Since you grab the raw query string, it's in Hex-encoded format.

Maybe that's a Good Thing to store in your database.

Maybe it's not.

All depends what you're going to do with it in the *REST* of the application.

But I cannot stress enough that you've got to understand where and how
this data is coming from, in what format, and *DESIGN* your application to
have the data you want in the place you want.

Going about it like you are now, just sort of guessing at what's there and
trying to slap in a patch to change it, is going to drive you crazy in the
long run.

Your solution isn't necessarily wrong:  Your approach to making the
decision is :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php