note 34564 added to function.get-magic-quotes-gpc
| From: | ron at hattworks dot com | Date: | Wed, 30 Jul 2003 22:49:43 +0000 |
| Subject: | note 34564 added to function.get-magic-quotes-gpc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-53039@lists.php.net to get a copy of this message | ||
doesn't this sound better?
define('STORE_TEXT', 0);
define('STORE_HTML', 1);
db_store($text, $allowables, $type = STORE_TEXT)
{
$text = ini_get('magic_quotes_gpc') ? $text : addslashes($text);
if(STORE_TEXT == $type)
{
$text = trim($text);
$text = strip_tags($text, $allowables);
$text = htmlspecialchars($text, ENT_QUOTES);
}
return $text;
}
checks the status of magic_quotes, if it is on - return just the text else - return with quotes
escaped
htmlspecialchars( ..., ENT_QUOTES) stores with no quotes!
hope this helps
----
Manual Page -- http://www.php.net/manual/en/function.get-magic-quotes-gpc.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34564
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34564&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34564&report=yes