note 75948 added to function.strip-tags
| From: | birwin at suddensales dot com | Date: | Sat, 23 Jun 2007 07:18:10 +0000 |
| Subject: | note 75948 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127897@lists.php.net to get a copy of this message | ||
This is an upgrade to the illegal characters script by robt. 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.
<?
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;
}
?>
----
Server IP: 216.235.15.211
Probable Submitter: 64.59.144.88 (proxied: 24.83.196.111)
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/75948
Del: integrated -- https://master.php.net/note/delete/75948/integrated
Del: useless -- https://master.php.net/note/delete/75948/useless
Del: bad code -- https://master.php.net/note/delete/75948/bad+code
Del: spam -- https://master.php.net/note/delete/75948/spam
Del: non-english -- https://master.php.net/note/delete/75948/non-english
Del: in docs -- https://master.php.net/note/delete/75948/in+docs
Del: other reasons-- https://master.php.net/note/delete/75948
Reject -- https://master.php.net/note/reject/75948
Search -- https://master.php.net/manage/user-notes.php