หน้า 1 จากทั้งหมด 1

code bane ip อย่างง่าย

โพสต์แล้ว: 14/02/2011 1:25 pm
โดย konseo

โค้ด: เลือกทั้งหมด

<?php
if (getenv(REMOTE_ADDR)=="127.0.0.1")
{
    echo "<script>window.location='http://www.sex.com ';</script>";
    exit;
}
?>
หรือแบนทั้งประเทศ
โหลด geoip.inc and geoip.dat
geoip.inc > http://geolite.maxmind.com/download/geoip/api/php/
geoip.dat > MaxMind - GeoLite Country | Open Source IP Address to Country Database
http://www.maxmind.com/app/geoip_country

โค้ด: เลือกทั้งหมด

<?php

include('geoip.inc'); //this file must exist in your directory

$gi = geoip_open('/your/path/to/GeoIP.dat',GEOIP_STANDARD);

// get the ip of the visitor
$addr = getenv('REMOTE_ADDR');
// translate his ip to a country code
$country = geoip_country_code_by_addr($gi, $addr);
// close the geo database
geoip_close($gi);

$badcountry = array('CN','TR');

// redirect them if they suck
if(in_array($country, $badcountry))
header('Location: http://www.SOMEDOMAIN.com '); //enter a url or page on your site

?> 

Re: code bane ip อย่างง่าย

โพสต์แล้ว: 15/02/2011 1:15 am
โดย imsn
อย่างง่ายจริงๆ ด้วยครับ แล้วมันใช้งานได้ดีเปล่าน่ะ

Re: code bane ip อย่างง่าย

โพสต์แล้ว: 15/02/2011 2:06 am
โดย konseo
imsn เขียน:อย่างง่ายจริงๆ ด้วยครับ แล้วมันใช้งานได้ดีเปล่าน่ะ
ต้องลองดูอะครับ เว็บผมเซ็งพวกฝรั่งมาspamมาก