Jump to content

IP Country range question


ronnie3148

Recommended Posts

Okay we are using a javascript, but the javascript that the site comes from has bans all irans ips... and it loads slow for those people, how would I place a if statement saying dont load this javascript if in Iran, thanks... I know how to do it, but I can't find a real set number, and I would use just 1 ip but the guy has dynamic... thanks ahead of time

Link to comment
https://forums.phpfreaks.com/topic/229117-ip-country-range-question/
Share on other sites

an easier way if your using this on one server may be to add iran to the ip blacklist

 

I have a program used in the USA that I have blacklisted common hacker countries

to avoid any potential issues. not that hackers arent in other countries but it cuts

down the probabilities.

 

here is a quote from somewhere else

 

[i ]someone with FF could just hit the Esc key as the jQuery was running and stop the block code from running. [/i]

 

on the other hand you could adapt the below script i found doing a quick search, use javascript split to pull apart the ip to see if it matches the

country code then silently redirect if it does

 

<script language="javascript">
var ip = '<!--#echo var="REMOTE_ADDR"-->'
if (ip == '206.186.23.178') { 
alert("STOP! You are viewing this page from an IP address that is not allowed!");
alert("Why can't you guys just leave me alone?");
if (confirm("Do you want to leave peacefully? Or will I have to help you?"))
{location.href="http://www.yahoo.com" } else { ("OK you choose I don't care! Bye bye! Don't come back!"); {location.href="http://www.yahoo.com" }} } 
</script>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.