I have a new feature on my site, where users can submit any text (I stopped all HTML entries) via a textarea. The main problem I still have though is that they could type “http://somewhere.com” which is something I want to stop. I also want to blacklist specific words. This is what I had before:
if (strpos($entry, "http://" or ".com" or ".net" or "www." or ".org" or ".co.uk" or "https://") !== true) {
die ('Entries cannot contain links!');
However that didn’t work, as it stopped users from submitting any text at all. So my question is simple, how can I do it?
This is a job for Regular Expressions.
What you need to do it something like this: