note 34564 deleted from function.get-magic-quotes-gpc by aidan

From: Date: Tue, 06 Jul 2004 06:20:27 +0000
Subject: note 34564 deleted from function.get-magic-quotes-gpc by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72697@lists.php.net to get a copy of this message
Note Submitter: ron@hattworks.com ---- 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

« previous php.notes (#72697) next »