Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Blocking IP's?

Status
Not open for further replies.

danima

Programmer
Jan 9, 2002
134
CA
Hi there....

My first post...here it goes. I am designing a site for a Canadian company that are selling on-line ONLY to Americans. They would like the URL to only be accessed by those IP's outside of Canada. I've been looking for a script that does that and can't find one. I know it's been done!

Would anyone know of a script that does this (preferably PHP)?

DANIMA
 
The owner made the decision. It's an offshoot of their business and, they do not want locals to view this particular portion of their site. The prices and products are different for the U.S. customers and they are trying to avoid calls as to why the Canadian customer is unable to purchase a particular product that is listed in the US section.
 
I see. CAD and USD is a big difference. May I suggest you take a look at what Dell does for this particular kind of problem? They use cookies to do this kind of thing but require the user chooses the country.

You could also check in the Apache forum if you use this as your web server. It allows you to send pages based on the language of the browser. Change your language in your browser (move to the top say Spanish) and then go to Google.com to see what I mean. Pretty nifty ain't it? :) Gary Haran
 
Hi,

You could attempt this but you would probably block a lot of legitimate traffic at the same time..

About the language, there are loads of people that don't set the language on their browser so that would be a dodgy thing to try..

Give me some time and I will try to think of the best option in this case..

Hope this helps Wullie

 
Wouldn't this involve getting the IP addresses of every Canadian ISP? Unless it is dictated by InterNIC that certain countries only have certain ip's available to them, but I highly doubt that. Even then, if a Canadian ISP is serving a US customer, s/he won't be buying much from you.
I remember downloading the 128 bit encryption pack for IE way back when, and Micosoft made you agree to a license agreement that you were located in the US in order to download it. If there was a way to do what you want, wouldn't MS have been able to implement such a system?
You can have the user choose which country they're in, but what if they say the US just to check out the difference?
I can't imagine how you'll do this, but keep us posted of your progress, I'm sure many people would like to know.
Good Luck! ;)
 
MikeT,

Correct, but if they intend to do this then they have to do all the work involved..

I cannot see another possible way to do this than to set up htaccess to restrict access to the site..

I really hope that someone has a solution to this and proves me wrong!! [wink]

Hope this helps Wullie

 
You could try the Enron approach: form a US "shell" company to market your product in the US and then do a global change on your company name.;-)
 
Hi mate,

I have not got a clue!! LOL

If I try to view the second URL then I get a totally different site. (I am in Scotland)

When the page is first called, it returns the following:


<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<HTML><HEAD>
<META http-equiv=Content-Type content=&quot;text/html; charset=windows-1252&quot;></HEAD>
<BODY></BODY></HTML>



Then it redirects and displays the following:


<SCRIPT LANGUAGE=&quot;javascript&quot;>
<!--
function ChangeToPopCat(){
var strTemp;
var strPort;

//strTemp = &quot; + &quot;:&quot; + &quot;80&quot; + &quot;/Default.htm&quot;
//strTemp = &quot; //top.location = strTemp
strTemp = &quot; //alert( &quot;Will redirect to: &quot; + strTemp );
top.location.replace(strTemp);
//
}
//-->
</SCRIPT>

<SCRIPT LANGUAGE=javascript>
<!--
ChangeToPopCat();

//-->
</SCRIPT>


Then the last redirect is to
The only way I can see the second URL is to disable javascript..

Someone here might be able to see something in that but it beyond me!! LOL

Hope this helps Wullie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top