kosmosinga Posted July 30 Share Posted July 30 We have a chat platform and one person is constantly spamming the same number, however, adding the number and thus bypassing the filter system. Example: 0 ## 7 ## 17 ## 88 ## 78 ## 12 0 "" "" 7 "" "" 1 "" "" "7887" "" 812 Is there any way to check, for example with preg_match or Normalizer, if the string contains exactly these 10 digits and any other symbols in the string are removed? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/322741-we-get-spam-and-we-have-a-question/ Share on other sites More sharing options...
requinix Posted July 30 Share Posted July 30 Sure, but that won't stop anything - they'll just find a way around it, or do something else. The only solution to spam that actually has any effect is adding a captcha to the form. That's for bots, of course. For human beings, you'll just have to block them. Quote Link to comment https://forums.phpfreaks.com/topic/322741-we-get-spam-and-we-have-a-question/#findComment-1631299 Share on other sites More sharing options...
Solution gizmola Posted July 30 Solution Share Posted July 30 I worked on a similar problem for a company some years back. It was also a chat system, and every chat message was filtered for a variety of personal information disclosure. This problem of people trying to get around these filters is difficult. When they are already putting in a bunch of whitespace and other characters to obfuscate (some of which are valid) is annoying. What I implemented was a chain of filters that would do take the original text and then strip out all the extra characters. In your case, this would not be too difficult, given that you are looking to blacklist a phone #. So: Generate a version of the message that has removed any characters that are not 0-9, or A-Z Convert newlines to something known Remove all whitespace (tabs and spaces) convert newline "something known" string or non-printable character back into newline use regex to find phone # sequences This should be farily simple, since you can use character classes and match [0-9]{9,12} From this list of numbers see if you can get a full match against any of these number sequences. Hopefully you get the idea. 1 Quote Link to comment https://forums.phpfreaks.com/topic/322741-we-get-spam-and-we-have-a-question/#findComment-1631327 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.