note 75948 deleted from function.strip-tags by danbrown

From: Date: Fri, 23 Sep 2011 16:04:24 +0000
Subject: note 75948 deleted from function.strip-tags by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-183382@lists.php.net to get a copy of this message
Note Submitter: birwin at suddensales dot com ---- This is an upgrade to the illegal characters script by rodt [on 16-JAN-07]. This script will handle the input, even if the one or all of the fileds include arrays. Of course another loop could be added to handle compound arrays within arrays, but if you are savvy enough to be using compound arrays, you don't need me to rewrite the program. <?php function screenForm($ary_check_for_html) { // check array - reject if any content contains HTML. foreach($ary_check_for_html as $field_value) { if(is_array($field_value)) { foreach($field_value as $field_array) // if the field value is an array, step through it { $stripped = strip_tags($field_array); if($field_array!=$stripped) { // something in the field value was HTML return false; } } }else{ $stripped = strip_tags($field_value); if($field_value!=$stripped) { // something in the field value was HTML return false; } } } return true; } ?>

« previous php.notes (#183382) next »