Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

lately I have spotted many spam streads showing strange text behaviour like the following: enter image description here

i tried to understand this but even chromes tools won't help much: enter image description here

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

like image 649
QQping Avatar asked Mar 24 '12 18:03

QQping


1 Answers

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');
}
like image 166
aurbano Avatar answered Sep 17 '22 23:09

aurbano