To prevent any execution of code, you can do the following: Before displaying the chat message, replace every
<
Symbol with the HTML equivalent. This is <
. In PHP this can be realised this way: $chatMessage = str_replace("<", "<", $chatMessage);
. Now no PHP and HTML code can be executed anymore. If you want to allow several HTML tags (image, link), you could try to detect this and then not replace the <
Symbol.
No comments:
Post a Comment