note 56483 added to function.strip-tags
| From: | bob at aol dot com | Date: | Sun, 04 Sep 2005 16:07:01 +0000 |
| Subject: | note 56483 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94724@lists.php.net to get a copy of this message | ||
christopher-kunz's example attack is further sterilized by ensuring magic_quotes_gpc is
enabled. nonetheless, xss should be taken seriously.. anther great input filter can be found at http://cyberai.com/inputfilter/
taken from the strip_slashes documentation, this simple function can be used to strip_tags in an
array:
<?php
function strip_tags_in_array($value){
$value = is_array($value) ?
array_map('strip_tags_in_array', $value) :
strip_tags($value);
return $value;
}
?>
Usage:
<?php
$array = array('<p>This paragraph</p>',
'<a href=#"
onclick="alert('alert');">Alert</a>');
$array = strip_tags_in_array($array);
?>
-Ominous Bob
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56483
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56483&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56483&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56483&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56483&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56483&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56483&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56483&report=yes
Search -- http://master.php.net/manage/user-notes.php