BigCommerce - Hosted Ecommerce Software by Interspire

Interspire Forum

Go Back   Interspire Forum > Interspire Shopping Cart Community Forum > Customization and Integration > Code Modification and Development Questions

Thread Tools Display Modes
Old 10-31-2014, 07:59 PM
Arin + Arin is offline
Interspire Customer
Join Date: Aug 2009
Posts: 11
Default Prevent store from loading based on IP address?

I want to completely prevent the online store from loading if the person accessing the store has an IP address other than one found in the USA.

I thought it would be as easy as editing the index.php file to something like this below. It actually works if they don't have a US IP address, but if they do I get “Fatal error: Cannot redeclare <function>” errors. I'm guessing it's loading functions a couple times in the index.php file based on how interspire works. Any ideas?

	$gi = geoip_open('GeoIP/GeoIPCity.dat',GEOIP_STANDARD);
	$ip = $_SERVER['REMOTE_ADDR'];		
	$ipRecord = geoip_record_by_addr($gi,$ip);	
		print '<p>The online store is for customers in the USA only. Please contact one of our <a href="">Local Importers</a> for pricing and purchasing in your country.';
		// Visitor tracking Javascript
		if(isset($_REQUEST['action'])) {
			if($_REQUEST['action'] == "tracking_script") {
				$visitor = GetClass('ISC_VISITOR');
			else if($_REQUEST['action'] == "track_visitor") {
				$visitor = GetClass('ISC_VISITOR');
		 * Index.php does something special - it passes off all requests
		 * to a worker function which decide on the page that should be
		 * shown.

Last edited by Arin; 10-31-2014 at 08:05 PM..
Reply With Quote

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