stopping html in posts?
Moderator: General Moderators
stopping html in posts?
I have a guestbook on my site http://www.irealms.co.uk , as it's just a form thats called into the page people can post html and script. Whats the best way to disable posting of links or script tags in a post?
PHP's function strip_tags will let you remove all html. it also allows you to keep certain tags, such as bold or italic or whatever.
http://us4.php.net/manual/en/function.strip-tags.php
http://us4.php.net/manual/en/function.strip-tags.php
You can use htmlentities() function to disable html entries before displaying back your text on the screen...
eg:
Mark
eg:
Code: Select all
<?
txt=htmlentities(txt);
echo txt;
?>Mark