Hoi,
Heb jij er ook zo last van;
Iemand bannen die vervolgens op een proxy terug komt?
Omdat 90% van de gebruikte proxys uit het buitenland komt (Buiten NL & BE) gewoon een simpele functie die kijkt of je vanaf een NL / BE IP adres de website bezoekt, of via een ander adres:
Met de php functie gethostbyaddr() wordt een landcode meegestuurd, deze kan je dus middels die functie opvragen en controleren of dat NL of BE is
.
Hoe je hem gebruikt:
Tada
Heb jij er ook zo last van;
Iemand bannen die vervolgens op een proxy terug komt?
Omdat 90% van de gebruikte proxys uit het buitenland komt (Buiten NL & BE) gewoon een simpele functie die kijkt of je vanaf een NL / BE IP adres de website bezoekt, of via een ander adres:
Met de php functie gethostbyaddr() wordt een landcode meegestuurd, deze kan je dus middels die functie opvragen en controleren of dat NL of BE is
.[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]function[/COLOR] land[COLOR= #007700]([/COLOR][COLOR= #0000BB]$ip[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #0000BB]$landCodes[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL] [COLOR= #007700]([/COLOR]
[COLOR= #DD0000]"nl"[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000]"nederland"[/COLOR][COLOR= #007700],[/COLOR]
[COLOR= #DD0000]"be"[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #DD0000]"belgie"[/COLOR][COLOR= #007700],
);[/COLOR]
[COLOR= #0000BB]$gethostbyaddr[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/gethostbyaddr"]gethostbyaddr[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ip[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gethostbyaddr[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]$ip[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [COLOR= #DD0000]"onbekend"[/COLOR][COLOR= #007700];
}[/COLOR]
[COLOR= #0000BB]$explode[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/explode"]explode[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"."[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$gethostbyaddr[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/foreach"]foreach[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$explode[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$key[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #0000BB]$ext[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$key[/COLOR][COLOR= #007700];
}[/COLOR]
[COLOR= #0000BB]$land[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$landCodes[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$ext[/COLOR][COLOR= #007700]];[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$land[/COLOR][COLOR= #007700]))
{[/COLOR]
[COLOR= #0000BB]$land[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"onbekend"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$land[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]nederland[/COLOR] [COLOR= #007700]||[/COLOR] [COLOR= #0000BB]$land[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]belgie[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/return"]return[/URL] true[COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/return"]return[/URL] false[COLOR= #007700];
}
}[/COLOR]
?> Hoe je hem gebruikt:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR]land[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]]))
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Jij woont in NL of BE[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Jij woont niet in NL of BE[/COLOR][COLOR= #007700];
}[/COLOR]
?> Tada

Ik woon in België maar ik word niet gezien als belg.
.
Dit is gewoon voor simpele websites ..