Re: [PHP] Problems with quotes in URL - SOLVED - plz FLAME me!!!

2003-06-18 Thread CPT John W. Holmes
No, I'm all for a public flaming... let him serve as an example to others!!
:)

In all honesty, I have posted about the htmlentities/htmlspecialchars()
requirement when putting data in form inputs quite a lot recently. You
should have picked up on it sooner. :) Oh well, though... at least you know
now... AND KNOWING IS HALF THE BATTLE!

---John Holmes...

- Original Message - 
From: "Aaron Gould" <[EMAIL PROTECTED]>
To: "'Petre Agenbag'" <[EMAIL PROTECTED]>; "'Chris Hayes'"
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, June 18, 2003 8:59 AM
Subject: RE: [PHP] Problems with quotes in URL - SOLVED - plz FLAME me!!!


Oh come on now, we don't flame people, or even engage in name-calling for
that matter on this list...  :)

We all learn our lessons.

--
Aaron Gould
Web Developer
Parts Canada



-Original Message-
From: Petre Agenbag [mailto:[EMAIL PROTECTED]
Sent: June 18, 2003 8:49 AM
To: Chris Hayes
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Problems with quotes in URL - SOLVED - plz FLAME me!!!


Hi lists ( and all the guys trying to help me)

Firstly

SORRY, I oversimplified my examples that I posted in the hope that I
would get to the solution faster.

What i failed to mention in my stupidity, was that I echoed the variable
as the value of a form input text field, so I actually messed up the
HTML, and I just realized it, and a simple $var = htmlspecialchars($var)
does the trick beautifully.

Again
Sorry guys, I really should have known better than to post stripped down
code as the problem is usually a simple thing like this...

Just for the by-and-by, my previous claims to having a "perfectly
working" application before upgrading to 4.3.1 was also then a load of
bull, and I only realized now that my app had this bug in it all the
time!

Just goes to show.

Anyway, I deserve a good flaming for this one!

I'm ready;)




On Wed, 2003-06-18 at 14:39, Chris Hayes wrote:
> (cutted the part about sending a var as get)
>
>
>page.php?my_var=whatever+whatever++%5C%22whatever+whatever%5C%22&next_var=b
labla
> ok so here the variable is still complete, including slashes and quotes.
>
>
> >And now, on page.php
> >
> >If I do an
> >
> >echo stripslashes($my_var);
> >
> >I get exactly this:
> >
> >whatever whatever \
>
> i get better results with
>
> echo stripslashes(urldecode($_GET['my_var']));
> (or in your version
> echo stripslashes(urldecode($my_var));
> )
>
>
> this even though Marek  said "Incomming GET values are urldecoded
> automaticaly, no need to do this." (this=urldecode)
>
>


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


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


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



RE: [PHP] Problems with quotes in URL - SOLVED - plz FLAME me!!!

2003-06-18 Thread Aaron Gould
Oh come on now, we don't flame people, or even engage in name-calling for
that matter on this list...  :)

We all learn our lessons.

--
Aaron Gould
Web Developer
Parts Canada

 

-Original Message-
From: Petre Agenbag [mailto:[EMAIL PROTECTED] 
Sent: June 18, 2003 8:49 AM
To: Chris Hayes
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Problems with quotes in URL - SOLVED - plz FLAME me!!!


Hi lists ( and all the guys trying to help me)

Firstly

SORRY, I oversimplified my examples that I posted in the hope that I
would get to the solution faster.

What i failed to mention in my stupidity, was that I echoed the variable
as the value of a form input text field, so I actually messed up the
HTML, and I just realized it, and a simple $var = htmlspecialchars($var)
does the trick beautifully.

Again
Sorry guys, I really should have known better than to post stripped down
code as the problem is usually a simple thing like this...

Just for the by-and-by, my previous claims to having a "perfectly
working" application before upgrading to 4.3.1 was also then a load of
bull, and I only realized now that my app had this bug in it all the
time!

Just goes to show.

Anyway, I deserve a good flaming for this one! 

I'm ready;)




On Wed, 2003-06-18 at 14:39, Chris Hayes wrote:
> (cutted the part about sending a var as get)
> 
>
>page.php?my_var=whatever+whatever++%5C%22whatever+whatever%5C%22&next_var=b
labla
> ok so here the variable is still complete, including slashes and quotes.
> 
> 
> >And now, on page.php
> >
> >If I do an
> >
> >echo stripslashes($my_var);
> >
> >I get exactly this:
> >
> >whatever whatever \
> 
> i get better results with
> 
> echo stripslashes(urldecode($_GET['my_var']));
> (or in your version
> echo stripslashes(urldecode($my_var));
> )
> 
> 
> this even though Marek  said "Incomming GET values are urldecoded 
> automaticaly, no need to do this." (this=urldecode)
> 
> 


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


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



Re: [PHP] Problems with quotes in URL - SOLVED - plz FLAME me!!!

2003-06-18 Thread Petre Agenbag
Hi lists ( and all the guys trying to help me)

Firstly

SORRY, I oversimplified my examples that I posted in the hope that I
would get to the solution faster.

What i failed to mention in my stupidity, was that I echoed the variable
as the value of a form input text field, so I actually messed up the
HTML, and I just realized it, and a simple $var = htmlspecialchars($var)
does the trick beautifully.

Again
Sorry guys, I really should have known better than to post stripped down
code as the problem is usually a simple thing like this...

Just for the by-and-by, my previous claims to having a "perfectly
working" application before upgrading to 4.3.1 was also then a load of
bull, and I only realized now that my app had this bug in it all the
time!

Just goes to show.

Anyway, I deserve a good flaming for this one! 

I'm ready;)




On Wed, 2003-06-18 at 14:39, Chris Hayes wrote:
> (cutted the part about sending a var as get)
> 
> >page.php?my_var=whatever+whatever++%5C%22whatever+whatever%5C%22&next_var=blabla
> ok so here the variable is still complete, including slashes and quotes.
> 
> 
> >And now, on page.php
> >
> >If I do an
> >
> >echo stripslashes($my_var);
> >
> >I get exactly this:
> >
> >whatever whatever \
> 
> i get better results with
> 
> echo stripslashes(urldecode($_GET['my_var']));
> (or in your version
> echo stripslashes(urldecode($my_var));
> )
> 
> 
> this even though Marek  said "Incomming GET values are urldecoded 
> automaticaly, no need to do this." (this=urldecode)
> 
> 


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



Re: [PHP] Problems with quotes in URL

2003-06-18 Thread Chris Hayes
(cutted the part about sending a var as get)

page.php?my_var=whatever+whatever++%5C%22whatever+whatever%5C%22&next_var=blabla
ok so here the variable is still complete, including slashes and quotes.


And now, on page.php

If I do an

echo stripslashes($my_var);

I get exactly this:

whatever whatever \
i get better results with

echo stripslashes(urldecode($_GET['my_var']));
(or in your version
echo stripslashes(urldecode($my_var));
)
this even though Marek  said "Incomming GET values are urldecoded 
automaticaly, no need to do this." (this=urldecode)



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


Re: [PHP] Problems with quotes in URL

2003-06-18 Thread Petre Agenbag
OK, this is the URL that my code produces after it get's the my_var from
the mysql table.
my_var in the table is => whatever whatever  "whatever whatever"

So I do a select and I do a $my_var = $myrow['my_var'] (after all the
proper mumbo jumbo about the $myrow = mysql_fetc_assoc...etc.)

I then do a $my_var = addslashes($my_var)as well as $my_var =
urlencode($my_var).
 Then I simply create a link like so:

echo 'link';

Clicking on that link displays exactly the following in the browser's
URL location:

page.php?my_var=whatever+whatever++%5C%22whatever+whatever%5C%22&next_var=blabla

And now, on page.php

If I do an 

echo stripslashes($my_var);

I get exactly this:

whatever whatever \


What am I missing?





On Wed, 2003-06-18 at 11:18, Chris Hayes wrote:
> >IN a mysql db, I would have a name like :[  whatever "whatever"  ]
> >
> >I do a select on the table and then echo the name on a page, as well as
> >add it to a url:
> >
> >page.php?myvar=$myvar
> >
> >where $myvar contains the [ whatever "whatever" ]
> >
> >Now, when I try to echo $myvar on the page.php, I don't get the entire
> >story.
> >
> >I tried to addslashes() before the url line, I tried urlencode() and
> >htmlspecialchars, all causes an echo  of $myvar on the page.php page to
> >only display whatever , or, whatever \ but NEVER, whatever "whatever"
> 
> 
> What does your link in which 'whatever' is look like ?
> How do you test to see what is in the variable?
> 
> 
> This does the job for me:
> 
>  
> if ($_GET['x']=='')
> {$i='whatever "Whatever"';
> echo 'link';
> 
> }
> else
> 
> echo 'x is '.urldecode($_GET['x']);
> 
> ?>
> 
> and the url looks like:http://www.X.nl/get.php?x=whatever+%22Whatever%22
> 
> 
> 
> 
> 
> 


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



Re: [PHP] Problems with quotes in URL

2003-06-18 Thread Marek Kilimajer
 > if ($_GET['x']=='')
{$i='whatever "Whatever"';
echo 'link';
}
else
echo 'x is '.urldecode($_GET['x']);
Incomming GET values are urldecoded automaticaly, no need to do this.

?>

and the url looks 
like:http://www.X.nl/get.php?x=whatever+%22Whatever%22









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


Re: [PHP] Problems with quotes in URL

2003-06-18 Thread Chris Hayes

IN a mysql db, I would have a name like :[  whatever "whatever"  ]

I do a select on the table and then echo the name on a page, as well as
add it to a url:
page.php?myvar=$myvar

where $myvar contains the [ whatever "whatever" ]

Now, when I try to echo $myvar on the page.php, I don't get the entire
story.
I tried to addslashes() before the url line, I tried urlencode() and
htmlspecialchars, all causes an echo  of $myvar on the page.php page to
only display whatever , or, whatever \ but NEVER, whatever "whatever"


What does your link in which 'whatever' is look like ?
How do you test to see what is in the variable?
This does the job for me:



if ($_GET['x']=='')
{$i='whatever "Whatever"';
echo 'link';
}
else
echo 'x is '.urldecode($_GET['x']);

?>

and the url looks like:http://www.X.nl/get.php?x=whatever+%22Whatever%22







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


[PHP] Problems with quotes in URL

2003-06-18 Thread Petre Agenbag
Hi List

I don't know what I'm doing wrong:

Firstly, I upgraded from 4.0.1 to 4.3.1 and made sure that I have
similar settings in php.ini wrt register_globals and magic_quotes.

I now have problems with some of my apps:


For instance:

IN a mysql db, I would have a name like :[  whatever "whatever"  ]

I do a select on the table and then echo the name on a page, as well as
add it to a url:

page.php?myvar=$myvar

where $myvar contains the [ whatever "whatever" ]

Now, when I try to echo $myvar on the page.php, I don't get the entire
story.

I tried to addslashes() before the url line, I tried urlencode() and
htmlspecialchars, all causes an echo  of $myvar on the page.php page to
only display whatever , or, whatever \ but NEVER, whatever "whatever"


What am I doing wrong?

Thanks



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