Script redirect IP for Multiple server

Posted by 22 February, 2012

Apabila website kita memerlukan akses dari berbagai belahan dunia, website tersebut akan lebih mudah diakses jika berada di lokasi visitor. Caranya termudah dengan menggunakan script yang bisa mendektesi ip berdasarkan negara kita, contoh adalah negara USA dan Indonesia.

Berikut kode mentah phpnya yang mesti dipasangkan:

Kode:

[?php
$country = geoip_country_code_by_name($_SERVER["REMOTE_ADDR"]);
if (!(($country == "US") or ($country == "CA") or ($country == "GB") or ($country == "AU"))) { die("Service Unavailable!"); }
?]

Yang udah dimodifikasi:

KODE

[?php
$country = geoip_country_code_by_name($_SERVER["REMOTE_ADDR"]);
if ($country== "ID") { echo "<meta http-equiv='refresh' content='0 ;URL=http://blog.cpnsonline.com/index.php'>"; }
elseif ($country == "US") { echo"<meta http-equiv='refresh' content='0 ;URL=http://www.cpnsonline/index.php'>"; }
?]

Categories : Blogging Tags :

Leave Comment

(required)

(required)