summaryrefslogtreecommitdiff
path: root/ifconfig
diff options
context:
space:
mode:
Diffstat (limited to 'ifconfig')
-rw-r--r--ifconfig/ifconfig.php10
-rw-r--r--ifconfig/index.php5
2 files changed, 9 insertions, 6 deletions
diff --git a/ifconfig/ifconfig.php b/ifconfig/ifconfig.php
index cf1dc8f..33ec5ba 100644
--- a/ifconfig/ifconfig.php
+++ b/ifconfig/ifconfig.php
@@ -19,9 +19,15 @@ class Ifconfig {
}
public function getAllGeoipRecords(){
+
$tmp = geoip_record_by_name( $this->ip );
- unset($tmp['dma_code']);
- unset($tmp['area_code']);
+ if( $tmp ){
+ unset($tmp['dma_code']);
+ unset($tmp['area_code']);
+ } else {
+ $tmp = array ( "status" => "Data not available");
+ }
+
return $tmp;
}
diff --git a/ifconfig/index.php b/ifconfig/index.php
index 83e03ed..a390ec2 100644
--- a/ifconfig/index.php
+++ b/ifconfig/index.php
@@ -1,12 +1,9 @@
<?php
-if ( strpos($_SERVER['HTTP_USER_AGENT'], 'libcurl') ){
+if ( strpos($_SERVER['HTTP_USER_AGENT'], 'curl') !== false ){
if ( empty($_GET) ){
echo $_SERVER["REMOTE_ADDR"];
exit;
- } else {
- // avoid redirect
- $_GET["curl"] = true;
}
}