note 85940 added to function.strip-tags
| From: | southsentry at yahoo dot com | Date: | Thu, 25 Sep 2008 16:15:42 +0000 |
| Subject: | note 85940 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144704@lists.php.net to get a copy of this message | ||
I was looking for a simple way to ban html from review posts, and the like. I have seen a few
classes to do it. This line, while it doesn't strip the post, effectively blocks people from
posting html in review and other forms.
if (strlen(strip_tags($review)) < strlen($review)) {
return false;
}
If you want to further get by the tricksters that use & for html links, include this:
if (strlen(strip_tags($review)) < strlen($review)) {
return false;
} elseif ( strpos($review, "&") !== false) {
return 5;
}
I hope this helps someone out!
----
Server IP: 64.71.164.2
Probable Submitter: 71.101.134.60
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/85940
Del: integrated -- https://master.php.net/note/delete/85940/integrated
Del: useless -- https://master.php.net/note/delete/85940/useless
Del: bad code -- https://master.php.net/note/delete/85940/bad+code
Del: spam -- https://master.php.net/note/delete/85940/spam
Del: non-english -- https://master.php.net/note/delete/85940/non-english
Del: in docs -- https://master.php.net/note/delete/85940/in+docs
Del: other reasons-- https://master.php.net/note/delete/85940
Reject -- https://master.php.net/note/reject/85940
Search -- https://master.php.net/manage/user-notes.php