How to prevent spam on websites like shown in the following pictures

最后都变了- 提交于 2019-12-10 14:15:43

问题


lately I have spotted many spam streads showing strange text behaviour like the following:

i tried to understand this but even chromes tools won't help much:

I have some websites online and want to implement a better spam protection client- and serverside but I need to know what to check in the first place. I need to know how this is done and maybe if it could be detected with a regex pattern.

any help would be appreciated!

p.s.: I wanted to write a better headline but I don't even know how this text behaviour is called and I didn't find anything on google


回答1:


It's not really SPAM, it's known as ZALGO. Detecting it in PHP is a bit tricky, try this regexp below:

if ( preg_match ( '/[^\x20-\x7E]/', $text ) || preg_match ( '/[^\x20-\x7E]/', $text ) ) {
    die('ZALGO not allowed');
}


来源:https://stackoverflow.com/questions/9854543/how-to-prevent-spam-on-websites-like-shown-in-the-following-pictures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!