How do you prevent people from using newline ("\n") in chat?
|
Jun 29 2015, 12:04 am
|
|
You could replace all of them with something else.
|
Nothing like html_encode() that just shows the text as is, and doesn't count \n as a newline?
|
If you had a function that could scan through a string and replace every instance of some string with another string, you could disable every \n in the original string.
For instance, you could use str_replace() from here like so: mob/verb/say(t as text) |
Thanks, very useful. Was secretly hoping for an html_encode that also disables all text macros, but \n is the only dangerous text macro that players can use so this'll be great.
|