Jump to content

HTML Tag Stripping from a Chat Message


Glenugie

Recommended Posts

So, I have a simple AJAX chat which I run on my website, but this post doesn't concern the AJAX at all, when inserting the message into my database using PHP + MySQL, I use the PHP function strip_tags(). But as this is a chat, this is rather innapropriate, as if a user sends message using a common emoticon (>.< for example), the < will be removed. There are several other common characters which are removed when used in chat, such as the plus sign.

 

Basically, I'm looking for a way to stop users from being able to insert HTML code into chat, without impeding the characters they can use typing a standard message. If there is a way to do it, I figured this would be the place to find out what it was. Even just a point in the right direction would be appreciated.

 

Thanks in advance for any replies :)

 

~Glenugie~

Link to comment
https://forums.phpfreaks.com/topic/190291-html-tag-stripping-from-a-chat-message/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.