Grab IP addresses of review spammers
Posted: Thu May 17, 2012 5:41 pm
Really quick one, we've been getting a lot of review spam of late, don't want to use CAPTCHA, so I'm just blocking the IP addresses of any spammers in our .htaccess. Anyway, current system doesn't record the IP of review posters, this quick bit of code changes that.
Open /includes/classes/class.review.php, look for:
Change to:
Then in your database, alter the isc_reviews table to include a column called 'reviewip'. You can now check who is spamming you before deleting their nonsense and banning them from accessing your site.
Open /includes/classes/class.review.php, look for:
Code: Select all
// Save the review in the database
$newReview = array(
"revproductid" => (int)$reviewPostData['product_id'],
"revfromname" => $reviewPostData['revfromname'],
"revdate" => time(),
"revrating" => max(1, min(5, $reviewPostData['revrating'])),
"revtext" => $reviewPostData['revtext'],
"revtitle" => $reviewPostData['revtitle'],
"revstatus" => $status
);
Code: Select all
// Save the review in the database
$newReview = array(
"revproductid" => (int)$reviewPostData['product_id'],
"revfromname" => $reviewPostData['revfromname'],
"revdate" => time(),
"revrating" => max(1, min(5, $reviewPostData['revrating'])),
"revtext" => $reviewPostData['revtext'],
"revtitle" => $reviewPostData['revtitle'],
"revstatus" => $status,
"reviewip" => getIp()
);