FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Convert BackslashQuote to Quote





sunpascal
hi,

i'm having trouble with the encoding of quotes in a form.

Everytime I post data through a form php converts all the quotes to backslash-quote (\").

Is there a way to undo or decode this so that I would again receive the "normal" quotes without the backslash?

thanks for your help
sunpascal
nevermind
str_ireplace does that
Stubru Freak
sunpascal wrote:
nevermind
str_ireplace does that


Stripslashes is probably easier.

PHP escapes your quotes for security reasons. It assumes you will use it in a MySQL query, and then it has to be escaped. The name of this feature is magic_quotes_gpc.
But this was a bad decision in most experts' opinion. The escaped variables aren't safe for MySQL yet, you have to first do stripslashes, and then mysql_real_escape_string. Also, a lot of GPC variables aren't going to be used for MySQL.
This also makes your code unsafe when porting it to a server without magic_quotes_gpc enabled. For this reason, according to php.net, "this feature has been DEPRECATED and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged."
I'd recommend disabling this feature, by setting it to off in a .htaccess file, and just making sure you properly escape your variables.
sunpascal
Stubru Freak wrote:
sunpascal wrote:
nevermind
str_ireplace does that


Stripslashes is probably easier.

PHP escapes your quotes for security reasons. It assumes you will use it in a MySQL query, and then it has to be escaped. The name of this feature is magic_quotes_gpc.
But this was a bad decision in most experts' opinion. The escaped variables aren't safe for MySQL yet, you have to first do stripslashes, and then mysql_real_escape_string. Also, a lot of GPC variables aren't going to be used for MySQL.
This also makes your code unsafe when porting it to a server without magic_quotes_gpc enabled. For this reason, according to php.net, "this feature has been DEPRECATED and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged."
I'd recommend disabling this feature, by setting it to off in a .htaccess file, and just making sure you properly escape your variables.


ok thanks for the advice
Related topics
All-In-One convert, author and burn AVI/DivX/Xvid/DV to DVD
convert ur PDF files to word documents
This is how to convert Ntfs to FAT32
how to convert *.swf to *.avi
Looking for easy way to convert my menu to flash
Convert your site to XHTML, prices vary
How to convert Xvid to VCD ?
Convert quicktime to .avi
"Convert to Css" with Html Kit
Convert CGI script to php and MySQL
Convert small table layout to CSS
Did you convert?
HELP!PLZ HELP ME!Convert swf to gif
Convert m4p to MP3
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.