note 99739 deleted from function.addslashes by danbrown

From: Date: Thu, 02 Sep 2010 15:27:00 +0000
Subject: note 99739 deleted from function.addslashes by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172277@lists.php.net to get a copy of this message
Note Submitter: Elvis Salaris ---- from: Danijel Pticar <?php function as_array(&$arr_r) { foreach ($arr_r as &$val) is_array($val) ? as_array($val):$val=addslashes($val); unset($val); } as_array($_POST); ?> Adding htmlspecialchars() to the $val should prevent submission of bad javascript... so: <?php function as_array(&$arr_r) { foreach ($arr_r as &$val) is_array($val) ? as_array($val):$val=htmlspecialchars(addslashes($val)); unset($val); } as_array($_POST); ?>

« previous php.notes (#172277) next »