Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have an idea for a website and I will be using a form to allow users to submit a text. The problem is that I don't want anyone to register(because I think that my idea is much more fun without registering as more people will use it) and by doing that I'm sure that people will spam the sh** out of my website.

My question is: What's the easiest way to prevent this from happening? It must be a really good way to block html code and any other pattern/tricks(spaces has to be filtered) spammers will use to submit links.. Of course I will use CAPTCHA to stop automated submission, my concern is about people manually submitting links.

Thanks in advance.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You could also moderate submissions or use a spam filtering service. There quite are a few services out there that have APIs:

http://akismet.com/

http://mollom.com

http://antispam.typepad.com

share|improve this answer
    
these are plugins for WordPress, etc. I build my own website. –  Loolooii Feb 11 '11 at 0:29
    
Correct, those services have plugins for WordPress, but they also have a direct API that you can use in your custom site. Mollom even has a PHP library premade for you to use. –  Josh Feb 11 '11 at 22:02

strip_tags should work for most cases. I personally favor using a more comprehensive library to handle user-submitted text. htmLawed is excellent for this purpose.

http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/index.php

share|improve this answer
    
It looks really complex. Isn't there something easier to work with? –  Loolooii Feb 11 '11 at 0:31
    
strip_tags is easy. htmLawed does take a little setting up, but once you have your options in place, it's easy too. Bottom line is that strip_tags is a solution you can use right away, look in to a library if it doesn't do what you need it to. –  Chris Feb 11 '11 at 0:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.