Forum Moderators: coopster
I am writing a MYSQL-driven website to publish articles. Visitors are allowed to leave comments on articles which are posted immediately below the article. Every time, somebody leaves a comment, it will be added to a 'comments' table in MySQL which then will be pulled automatically from the DB and placed below the article. I am very concerned about Comment Spam. What if spammer simply create automated scripts to create hundreds of backlinks to their pages and mess everything up?
Would I be 100% safe by simply deleting the "<" and ">" characters from any comment before it is added to my database? Or are there any other characters I should kick out?
<?php
$filter = array("<", ">");
$comment = str_replace($filter, "", $comment);
?>
You'd be better off using a captcha script to weed out automated posting.
Not necessarily [captcha.net]--or at least a captcha may not be sufficient on its own:
Several groups have created programs that can pass many CAPTCHAs over 80% of the time
-b
[webmasterworld.com...]
Maybe I am thinking too not far enough; but if I simply filter out the < and the >, there is no way anybody could execute anything, right? No php, no html, no nothing? Or did I miss anything? I am not expecting mass traffic and an e-mail is sent for every comment; so I give it a try. My site is live now. Example for the Comment here:
http://www.example.com/content.html?id=3009 (add a "." after www. Comment form is at the bottom of page)
Feel free to leave a test comment ;-) I am still in the launching phase and can sort them out.
[edited by: coopster at 4:23 pm (utc) on April 17, 2006]
[edit reason] generalized url [/edit]