note 15913 added to function.strip-tags
| From: | ryland at ryland dot net | Date: | Mon, 08 Oct 2001 17:46:14 +0000 |
| Subject: | note 15913 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18684@lists.php.net to get a copy of this message | ||
This function seems to work for me. Allowable tags are
'<b><i><u><a>', and it strips out all parameters except for HREFs.
function safeHTML($text) {
$text = stripslashes($text);
$text = strip_tags($text, '<b><i><u><a>');
$text = ereg_replace ("<a[^>]+href *= *([^ ]+)[^>]*>", "<a
href=\\1>", $text);
$text = ereg_replace ("<([b|i|u])[^>]*>", "<\\1>",
$text);
return $text;
}
--
http://www.php.net/manual/en/function.strip-tags.php
http://master.php.net/manage/user-notes.php?action=edit+15913
http://master.php.net/manage/user-notes.php?action=delete+15913
http://master.php.net/manage/user-notes.php?action=reject+15913