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
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>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.