Reply to Re: Removing quote escapes

Your name:

Reply:


Posted by Hilarion on 09/07/05 15:14

>> index.php?myvar=cheese
>>
>> if I ehco($myvar) it will display 'cheese',
>>
>> index.php?myvar=%22cheese%22
>>
>> if I echo($myvar) it will display '\"cheese\"' with escaped quotes.
>>
>> How can I remove the quote escapes if %22 is present value? I want the
>> second example to display just like the first, whether quotes are present or
>> not?
>
> you can use urldecode() and htmlentities()...
>
> like
>
> $myvar = urldecode($myvar);
>
> u can also use htmlentities(urldecode($myvar)); for correct html code.


What is "htmlentities" for here?
One should use "urlencode" to pass parameter values in PHP generated
URLs. "htmlentities" makes nothing if the value is urlencoded (cause
it does not contain any HTML entities when encoded).
The problem that Mark has is related to magic quotes. He probably has
"magicquotes_gpc" turned on, which causes PHP to escape all values
from the client ($_GET, $_POST, $_COOKIE, $_REQUEST and all variables
comming from those if "register_globals" is on). He should turn
magic quotes off or use "stripslashes". It's important to do proper
escaping if data from the client is used in SQL queries or as otherwise
executed code (by "eval" or some shell function).


Hilarion

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация