note 84867 deleted from function.htmlentities by danbrown

From: Date: Sun, 17 May 2009 16:46:34 +0000
Subject: note 84867 deleted from function.htmlentities by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154889@lists.php.net to get a copy of this message
Note Submitter: anotheruser at example dot com ---- This looping function below is useful to disable html in user generated content (message board posts, webpage-based chat clients, etc). And, so far, it's worked fine alone for sanitizing user input for database storage. "htmlize_text" here preserves keys and works on recursive arrays. <?php $_GET = htmlize_text($_GET); $_POST = htmlize_text($_POST); function htmlizeArray(&$txtArray) { if (is_array($txtArray)) { foreach ($txtArray as $key => $val) { htmlizeArray($val); } } else { htmlentities($txtArray); } } ?>

« previous php.notes (#154889) next »