RE: [PHP] Magic quotes and addslashes()
| From: | John W. Holmes | Date: | Wed, 09 Apr 2003 02:32:47 +0000 |
| Subject: | RE: [PHP] Magic quotes and addslashes() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142989@lists.php.net to get a copy of this message | ||
> I'm a developer of a PHP product for commercial use (it's open source
> though), and I'm wondering which is the best; require the user to
enable
> magic_quotes in PHP or using addslashes() on all data inserted into
the
> database? For the developers, it's one thing less to think of but
maybe
> it could be bad for the users. Thank you in advance.
You're program should handle the data correctly in either case. Use
get_magic_quotes_gpc() to see if it's enabled or not. If it is, then you
don't need to do anything. If it's not, then you need to run addslashes
yourself. This should be transparent to the user.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/