GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Redirect Your traffic from specific countries. (https://gfy.com/showthread.php?t=1025277)

cooldude7 06-03-2011 11:58 PM

Redirect Your traffic from specific countries.
 
Okie, i was getting traffic from malaysia and site was using full resources of cpu so host told me to do something about it.,

so i used this

Code:

<script src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
<script type="text/javascript">
    switch(geoplugin_countryCode()){
        case "MY" :
            document.location.href = "http://www.xxxtreme.com/blocked.html";
            break;
    }
</script>


</head>

will c how it goes.

thanks to you all for all ur useless reply's j/k. GFY.. not kidding. :1orglaugh

Seth Manson 06-04-2011 12:07 AM

Its better to use php and redirect them from there before your html page even loads. You can still do it for free, maxmind gives away the database for it and even tells you how to do it on their website.

Barry-xlovecam 06-04-2011 12:10 AM

This does? Count/convert the money in my wallet? :1orglaugh
Code:

function geoplugin_city() { return '**';}
function geoplugin_region() { return '**';}
function geoplugin_regionCode() { return '**';}
function geoplugin_regionName() { return '**';}
function geoplugin_areaCode() { return '**';}
function geoplugin_dmaCode() { return '**';}
function geoplugin_countryCode() { return 'US';}
function geoplugin_countryName() { return 'United States';}
function geoplugin_continentCode() { return 'NA';}
function geoplugin_latitude() { return '42.**';}
function geoplugin_longitude() { return '-83.**';}
function geoplugin_currencyCode() { return 'USD';}
function geoplugin_currencySymbol() { return '$';}
function geoplugin_currencyConverter(amt, symbol) {
        if (!amt) { return false; }
        var converted = amt * 1;
        if (converted <0) { return false; }
        if (symbol === false) { return Math.round(converted * 100)/100; }
        else { return '$'+(Math.round(converted * 100)/100);}
        return false;
}

The ** were omitted but the values were close

ThatOtherGuy - BANNED FOR LIFE 06-04-2011 12:20 AM

Interesting. I'll take it.

Barry-xlovecam 06-04-2011 12:32 AM

Just add these to the root .htaccess file

http://www.ipdeny.com/ipblocks/data/countries/my.zone

Code:

<Files 403.shtml>
order allow,deny
allow from all
</Files>

#then all the malaysia ips on the above URL

This not stopping the traffic to the server but the IPs will get a 403 - Forbidden 57 bytes?

Blocking entire countries is best done with mod_geoip for Apache2 (Debian) Google for mod_geoip

cooldude7 06-04-2011 12:35 AM

Quote:

Originally Posted by Barry-xlovecam (Post 18193568)
Just add these to the root .htaccess file

http://www.ipdeny.com/ipblocks/data/countries/my.zone

Code:

<Files 403.shtml>
order allow,deny
allow from all
</Files>

#then all the malaysia ips on the above URL

This not stopping the traffic to the server but the IPs will get a 403 - Forbidden 57 bytes?

Blocking entire countries is best done with mod_geoip for Apache2 (Debian) Google for mod_geoip

i dont want surfers to view some 403 error, i wanna give them specific reason ....

cooldude7 06-04-2011 12:36 AM

Quote:

Originally Posted by Barry-xlovecam (Post 18193512)
This does? Count/convert the money in my wallet? :1orglaugh
Code:

function geoplugin_city() { return '**';}
function geoplugin_region() { return '**';}
function geoplugin_regionCode() { return '**';}
function geoplugin_regionName() { return '**';}
function geoplugin_areaCode() { return '**';}
function geoplugin_dmaCode() { return '**';}
function geoplugin_countryCode() { return 'US';}
function geoplugin_countryName() { return 'United States';}
function geoplugin_continentCode() { return 'NA';}
function geoplugin_latitude() { return '42.**';}
function geoplugin_longitude() { return '-83.**';}
function geoplugin_currencyCode() { return 'USD';}
function geoplugin_currencySymbol() { return '$';}
function geoplugin_currencyConverter(amt, symbol) {
        if (!amt) { return false; }
        var converted = amt * 1;
        if (converted <0) { return false; }
        if (symbol === false) { return Math.round(converted * 100)/100; }
        else { return '$'+(Math.round(converted * 100)/100);}
        return false;
}

The ** were omitted but the values were close

i dont get it , what are u saying ??

Barry-xlovecam 06-04-2011 01:07 AM

http://www.geoplugin.net/javascript.gp run your script in a browser its looks like a currency converter ...

it doesnt do anything

if function geoplugin_countryCode() {return MY} then?

if (!amt) { return false; } amt is the amount from the shopping cart?

Where did you find this?


Edit: From here http://www.geoplugin.com/quickstart

this does not redirect or block with geo-ip

cooldude7 06-04-2011 02:06 AM

Quote:

Originally Posted by Barry-xlovecam (Post 18193588)
http://www.geoplugin.net/javascript.gp run your script in a browser its looks like a currency converter ...

it doesnt do anything

if function geoplugin_countryCode() {return MY} then?

if (!amt) { return false; } amt is the amount from the shopping cart?

Where did you find this?


Edit: From here http://www.geoplugin.com/quickstart

this does not redirect or block with geo-ip

lol, thanks for the info.,

but what it does is give the country code., and then


i use

switch(geoplugin_countryCode()){
case "MY" :
document.location.href = "http://www.xxxtreme.com/blocked.html";
break;

to check if the country code is MY , and then it redirects it to given url.

thanks for your time.

Barry-xlovecam 06-04-2011 02:25 AM

OK that is one way to do it ...
"Visitors from this country are currently blocked, Sorry for the inconvenience. " LOL that is better?

Should work ...

You only posted part of the code ...

The difference is the server resource usage.
I don't like using services they have a way of disappearing or starting to charge for services. Better to run this sort of thing yourself IMHO.

cooldude7 06-04-2011 05:15 AM

Quote:

Originally Posted by Barry-xlovecam (Post 18193652)
OK that is one way to do it ...
"Visitors from this country are currently blocked, Sorry for the inconvenience. " LOL that is better?

Should work ...

You only posted part of the code ...

The difference is the server resource usage.
I don't like using services they have a way of disappearing or starting to charge for services. Better to run this sort of thing yourself IMHO.

i posted the complete code in my 1st post,

anyways i just checked server stats and memory usage are overheating..,
i guess traffic coming to the index.php and then redirecting also causing issues...so i m gonna try 403 htaccess method.

will c if server resource goes down.


All times are GMT -7. The time now is 03:13 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc