BigCommerce - Hosted Ecommerce Software by Interspire

Interspire Forum

 
Go Back   Interspire Forum > Interspire Shopping Cart Community Forum > Customization and Integration > Code Modification and Addon Releases

Reply
 
Thread Tools Display Modes
  #1  
Old 05-17-2012, 05:42 PM
tonybarnes + tonybarnes is offline
Interspire Customer
 
Join Date: Dec 2008
Posts: 1,285
Default Check for review spammers IPs so you can blacklist them

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:

Code:
		// 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
		);
Change to:

Code:
		// 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()
		);
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.
__________________
www.savant-health.com
Reply With Quote
  #2  
Old 02-27-2017, 10:46 PM
Dustin013 + Dustin013 is offline
Interspire Customer
 
Join Date: Jul 2009
Location: Scottsdale, AZ
Posts: 90
Send a message via MSN to Dustin013 Send a message via Skype™ to Dustin013
Lightbulb

Thanks for the post, but I got a client today who attempted the modification and wasn't able to really get it to work quite right. First off the GetIP function is case sensitive and it is "GetIP" not "getIp". Aside from that, I decided I would go another step further and add in back-end code to view the collected IP addresses so you didn't have to view from the DB table. So with a few tweaks I was able to get everything working correctly and even make the mod a little more user friendly to those who aren't familiar with MySQL. Please check out my blog post at

http://thinkgenius.com/2017/02/27/ad...ws-interspire/

I am including all the code and files that need modification to capture the IP address along with the back-end modifications to allow you to view the IP address when viewing and editing product comments. Enjoy!

Need help with your ISC cart? Contact me @ dustin@thinkgenius.com!
__________________
Dustin Holdiman
Senior Software Architect / Project Manager
dustin@thinkgenius.com
http://www.thinkgenius.com
Looking for custom coding for your cart?
Automation, creating new features, editing existing features... We do anything custom for Interspire. So feel free to contact us for a free quote. We are active and always eager to help!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump