|

�ѹ�������й� ���ͧ���¾ʹշҧ����ҡ�����Ҥ��������ҹ���Ҩҡ ISP 㴺�ҧ �������������Ң����� ���Ըա�õ�Ǩ�ͺ�� � �ҽҡ��Ѻ ��͹�����µ�ͧ������ҡ������ҧ isp list ����ҡ�͹ �ѹ�����Ҩз�੾�� check ISP 㹻��������ҹ�鹹Ф�Ѻ
���ҧ��� isplist.txt ����Ҥ�Ѻ ���ͨ���ŧ mysql �������ҡѹ��Ѻ
973602816,973864959,TRUENET
977272832,977305599,BuddyB
981991424,982122495,csloxinfo-th
982712320,982745087,Maxnet
1023901696,1023934463,CAT-BB-NET
1029308416,1029439487,HUAWEI-TRUEHISP-ASIANET
1966014464,1966079999,testing max net
1990983680,1991245823,TOT-NET
2088239104,2088435711,TRUEBB-NET
2090696704,2090729471,Maxnet
2098724864,2098987007,TOT
2657878016,2657943551,KU
2717253632,2717319167,KMITL
2826436608,2826502143,TH-AU-NET
3390832640,3390963711,UniNet(Inter-university network)
3394924544,3394928639,QNET-TH-NET
3400926208,3400933375,Far East Internet
3398156288,3398164479,Hutchison CAT Wireless
3413180416,3413213183,TOT
3398402048,3398418431,edNET
3415343104,3415408639,LOXINFO-TH
3415506944,3415556095,A-Net
3523514624,3523514751,AMARI-TH
3537174528,3537190911,TRUENET
3539353600,3539402751,Samart Infonet
3732602880,3732668415,Maxnet
�ҡ�����ǹ header �ͧ������ͧ��õ�Ǩ�ͺ ���Լ�����¹���� index.php ��Ѻ
if (trim($ip) == ""){
$ip = getenv("HTTP_X_FORWARDED_FOR");
if (trim($ip) == ""){
$ip = getenv("REMOTE_ADDR");
}
}
if ($ip == "unknown"){$ip = getenv("REMOTE_ADDR");} // ���� IP ����Ф�Ѻ
���仡�������ŧ IP Address �� Interger ���� function ����Ѻ
function ip2int($ip) {
if(preg_match('/^\\D*(\\d+)\\D(\\d+)\\D(\\d+)\\D(\\d+)\\D*$/', $ip, $array)) {
return (16777216 * $array[1] + 65536 * $array[2] + 256 * $array[3] + 1 * $array[4]);
} else {
return (0);
}
}
�Դ���������ҹ���������Ѻ
$fs = fopen("isplist.txt","r");
$isplist = fread($fs,filesize("isplist.txt"));
fclose($fs);
$arisplist = explode("\\n",$isplist);
foreach($arisplist as $val){
if (trim($val) != ""){
list($s,$e,$isp) = split(",",$val);
$ip2int = ip2int($ip);
if (($ip2int >= $s)&&($ip2int <= $e)){
$yourisp = $isp; // ��º���� text file ���ǡ������ ISP ����¤�Ѻ
}
}
}
if (trim($yourisp == "")){ // �óչ���������� ISP �� ������� IP Address ����͹������ѧ�դ�Ѻ
$yourisp = gethostbyaddr($ip);
$aryourisp = explode(".",$yourisp);
$yourisp = strtoupper($aryourisp[count($aryourisp)-3]).".".strtoupper($aryourisp[count($aryourisp)-2]).".".strtoupper($aryourisp[count($aryourisp)-1]);
}
��ҹ�����Ф�Ѻ ������ö�Ӥ�� $youtisp ���ҹ�����Ǥ�Ѻ
�������� � �ҡ : ï¿½Ñ°ï¿½Ñ àµªÐ¡Ò��ǧ��
Webdesign Article : |