note 72369 deleted from function.strip-tags by danbrown

From: Date: Sun, 17 May 2009 15:57:14 +0000
Subject: note 72369 deleted from function.strip-tags by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154723@lists.php.net to get a copy of this message
Note Submitter: rodt ---- I have used this function successfully to prevent bots inserting HTML to web forms. Put the fields' contents into an array, then feed array to this function as an argument. Returns false if HTML is included; true if there is no HTML in any of the array's values. Hope it's helpful to someone. /* Checks that there is no HTML in any of provided fields. $ary_no_html_allowed = Array to check for HTML content. */ function screenForm($ary_check_for_html){ // check array - reject if any content contains HTML. foreach($ary_check_for_html as $field_value) { $stripped = strip_tags($field_value); if($field_value!=$stripped) { // something in the field value was HTML return false; } } return true; } }

« previous php.notes (#154723) next »