note 85940 deleted from function.strip-tags by googleguy

From: Date: Tue, 22 Oct 2013 08:02:56 +0000
Subject: note 85940 deleted from function.strip-tags by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196764@lists.php.net to get a copy of this message
Note Submitter: southsentry at yahoo dot com ---- 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. <?php 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: <?php if (strlen(strip_tags($review)) < strlen($review)) { return false; } elseif ( strpos($review, "&") !== false) { return 5; } ?> I hope this helps someone out!

« previous php.notes (#196764) next »