ronnie3148 Posted February 28, 2011 Share Posted February 28, 2011 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 More sharing options...
gevensen Posted February 28, 2011 Share Posted February 28, 2011 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 https://forums.phpfreaks.com/topic/229117-ip-country-range-question/#findComment-1180755 Share on other sites More sharing options...
Pikachu2000 Posted February 28, 2011 Share Posted February 28, 2011 Javascript is pretty useless for that. All the user has to do is disable javascript. Link to comment https://forums.phpfreaks.com/topic/229117-ip-country-range-question/#findComment-1180982 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.