note 22339 added to function.htmlspecialchars
| From: | advocat at ukrpost dot net | Date: | Fri, 14 Jun 2002 06:56:00 +0000 |
| Subject: | note 22339 added to function.htmlspecialchars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31848@lists.php.net to get a copy of this message | ||
in russian: ëó÷øå èñïîëüçîâàòü ñïåöèàëüíûé êîä, è íå
ïîçâîëÿòü ïîëüçîâàòåëÿì èñïîëüçîâàòü îáû÷íûé html, ýòî
êàê ìèíèìóì ïðåäîòâðàòèò ïîÿâëåíèå <script... è òä...
ex.:
function flt_tags($text) {
$text = ereg_replace("r", "", $text);
$text = ereg_replace("n", "[br]", $text);
$text = str_replace("<", "<", $text);
$text = str_replace(">", ">", $text);
$text = str_replace("[br", "<br", $text);
$text = str_replace("[p", "<p", $text);
$text = str_replace("[b", "<b", $text);
$text = str_replace("[/b", "</b", $text);
$text = str_replace("[i", "<i", $text);
$text = str_replace("[/i", "</i", $text);
$text = str_replace("[/u", "<u", $text);
$text = str_replace("[/u", "</u", $text);
$text = str_replace("[font color=", "<font color=", $text);
$text = str_replace("[font size=", "<font size=", $text);
$text = str_replace("[/font", "</font", $text);
$text = str_replace("[url=","<a target=_blank href=",$text);
$text = str_replace("[/url","</a",$text);
$text = str_replace("]",">",$text);
$text = stripslashes($text);
$text = trim($text);
return $text;
}
--
http://www.php.net/manual/en/function.htmlspecialchars.php
http://master.php.net/manage/user-notes.php?action=edit+22339
http://master.php.net/manage/user-notes.php?action=delete+22339
http://master.php.net/manage/user-notes.php?action=reject+22339