Exemple #1
1
function getGeo($ip)
{
    $geoplugin = new geoPlugin();
    $geoplugin->locate($ip);
    $geoip = geoip_record_by_name($ip);
    $geo = false;
    if (!empty($geoip)) {
        $geoip = array2object($geoip);
        // geoip delivers (sometimes)the strings in ISO-8859-1, convert non utf-8 into  UTF8 ( not UTF-8 )
        foreach ($geoip as $key => $val) {
            if (in_array($key, array('city', 'country_name'))) {
                $encoding = mb_detect_encoding($geoip->{$key});
                if ($encoding != 'UTF-8') {
                    $geoip->{$key} = iconv($encoding, 'UTF8//IGNORE', $geoip->{$key});
                }
            }
        }
        $geo = normalize_geo(false, $geoplugin);
        utf8_encode_deep($geo);
    }
    return $geo;
}
Exemple #2
0
                       
                    </div>
                </div>
            </div>
        </div>
    </div>
    <?php 
}
?>
    
    <div id="sections">
    	<div class="section">
        	<!--<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>-->
			<?php 
require_once 'geoplugin.class.php';
$geoplugin = new geoPlugin();
//$ip = $_SERVER['REMOTE_ADDR'];
//$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
//locate the IP
$geoplugin->locate();
$ct = $geoplugin->city;
$rg = $geoplugin->region;
$cy = $geoplugin->countryName;
//echo "$cy";
?>
 
            <div class="latestbylocation">
                <div class="container">
                    <div class="row">
                        <div class="col-md-12">
                        <h3><?php 
Exemple #3
0
	<body>
		<h1>Autor: Victor Lana</h1>
		<h1><b>Especialidad:</b> Ingenier&iacutea del Software</h1>
		<h1><b>Universidad:</b> UPV/EHU</h1>	
	
		<p align = center> 
			<img src="imagenes/silueta.gif" alt="Imagen Victor Lana" width="300em" height="300em"/>
		</p>
		
		<p align = center> 	
			<a href="layout.html">Ir al Layout</a>
		</p>
		
		<?php 
require_once './php/geoplugin.class/geoplugin.class.php';
$geoplugin = new geoPlugin();
//Remote address
$geoplugin->locate();
$remote_ip_address = $geoplugin->ip;
$remote_city = $geoplugin->city;
$remote_country = $geoplugin->countryName;
$remote_long = $geoplugin->longitude;
$remote_lat = $geoplugin->latitude;
//Local address
$servlocal = $_SERVER['SERVER_ADDR'];
$geoplugin->locate($servlocal);
$local_ip_address = $geoplugin->ip;
$local_city = $geoplugin->city;
$local_country = $geoplugin->countryName;
$local_long = $geoplugin->longitude;
$local_lat = $geoplugin->latitude;
 public static function find()
 {
     $g = new geoPlugin();
     $g->locate();
 }
Exemple #5
0
             Flight::set('latitude', $row['geoplugin_latitude']);
         }
         if (strlen($row['geoplugin_longitude']) > 0) {
             Flight::set('longitude', $row['geoplugin_longitude']);
         }
         if (strlen($row['geoplugin_regionCode']) > 0) {
             Flight::set('regionCode', $row['geoplugin_regionCode']);
         }
         if (strlen($row['geoplugin_regionName']) > 0) {
             Flight::set('regionName', $row['geoplugin_regionName']);
         }
     }
     Flight::set('geoinfo', true);
 } else {
     require 'includes/geoplugin.class.php';
     $geoplugin = new geoPlugin();
     $geoplugin->locate($ip);
     // geoplugin.com API up?
     if (strlen($geoplugin->ip) > 0) {
         $ipquery = "INSERT INTO geo (ip, geoplugin_city, geoplugin_region, geoplugin_areaCode, geoplugin_dmaCode, geoplugin_countryCode, geoplugin_countryName, geoplugin_continentCode, geoplugin_latitude, geoplugin_longitude, geoplugin_regionCode, geoplugin_regionName) VALUES(:ip, :geoplugin_city, :geoplugin_region, :geoplugin_areaCode, :geoplugin_dmaCode, :geoplugin_countryCode, :geoplugin_countryName, :geoplugin_continentCode, :geoplugin_latitude, :geoplugin_longitude, :geoplugin_regionCode, :geoplugin_regionName)";
         $stmt = $db->prepare($ipquery);
         $stmt->bindParam(':ip', $geoplugin->ip);
         $stmt->bindParam(':geoplugin_city', $geoplugin->city);
         $stmt->bindParam(':geoplugin_region', $geoplugin->region);
         $stmt->bindParam(':geoplugin_areaCode', $geoplugin->areaCode);
         $stmt->bindParam(':geoplugin_dmaCode', $geoplugin->dmaCode);
         $stmt->bindParam(':geoplugin_countryCode', $geoplugin->countryCode);
         $stmt->bindParam(':geoplugin_countryName', $geoplugin->countryName);
         $stmt->bindParam(':geoplugin_continentCode', $geoplugin->continentCode);
         $stmt->bindParam(':geoplugin_latitude', $geoplugin->latitude);
         $stmt->bindParam(':geoplugin_longitude', $geoplugin->longitude);
Exemple #6
0
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. 
However, the license header, copyright and author credits 
must not be modified in any form and always be displayed.
This class is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
@author geoPlugin (gp_support@geoplugin.com)
@copyright Copyright geoPlugin (gp_support@geoplugin.com)
This file is an example PHP file of the geoplugin class
to geolocate IP addresses using the free PHP Webservices of
http://www.geoplugin.com/
*/
require_once 'geoplugin.class.php';
$geoplugin = new geoPlugin();
/* 
Notes:
The default base currency is USD (see http://www.geoplugin.com/webservices:currency ).
You can change this before the call to geoPlugin::locate with eg:
$geoplugin->currency = 'EUR';
The default IP to lookup is $_SERVER['REMOTE_ADDR']
You can lookup a specific IP address, by entering the IP in the call to geoPlugin::locate
eg
$geoplugin->locate('209.85.171.100');
*/
//locate the IP
$geoplugin->locate();
echo "Geolocation results for {$geoplugin->ip}: <br />\n" . "City: {$geoplugin->city} <br />\n" . "Region: {$geoplugin->region} <br />\n" . "Area Code: {$geoplugin->areaCode} <br />\n" . "DMA Code: {$geoplugin->dmaCode} <br />\n" . "Country Name: {$geoplugin->countryName} <br />\n" . "Country Code: {$geoplugin->countryCode} <br />\n" . "Longitude: {$geoplugin->longitude} <br />\n" . "Latitude: {$geoplugin->latitude} <br />\n" . "Currency Code: {$geoplugin->currencyCode} <br />\n" . "Currency Symbol: {$geoplugin->currencySymbol} <br />\n" . "Exchange Rate: {$geoplugin->currencyConverter} <br />\n";
/*
How to use the in-built currency converter
Exemple #7
0
<div class="whitebox">
<!-- ####################################################################################################### -->
<h2>Geolocation information gathered from the top 10 IP addresses probing the system</h2>
<hr/>

<?php 
#Author: ikoniaris
#Website: bruteforce.gr/honeyd-viz
require_once 'include/rb.php';
require_once 'include/libchart/classes/libchart.php';
require_once 'include/qgooglevisualapi/config.inc.php';
require_once 'include/geoplugin/geoplugin.class.php';
require_once 'include/misc/ip2host.php';
require_once 'config.php';
//We initialize the geoplugin component (used below to decode IPs)
$geoplugin = new geoPlugin();
//Let's connect to the database
R::setup('mysql:host=' . DB_HOST . ';port=' . DB_PORT . ';dbname=' . DB_NAME, DB_USER, DB_PASS);
//-----------------------------------------------------------------------------------------------------------------
//NUMBER OF CONNECTIONS PER IP
//-----------------------------------------------------------------------------------------------------------------
$exclude_filter = EXCLUDE_FILTER;
$db_query = "SELECT source_ip, COUNT(source_ip)\n  FROM connections\n  WHERE source_ip NOT LIKE '{$exclude_filter}'\n  GROUP BY source_ip\n  ORDER BY COUNT(source_ip) DESC\n  LIMIT 10 ";
$rows = R::getAll($db_query);
if (count($rows)) {
    //We create a new vertical bar chart, a new pie chart and initialize the dataset
    $verticalChart = new VerticalBarChart(600, 300);
    $pieChart = new PieChart(600, 300);
    $dataSet = new XYDataSet();
    //We create a "intensity" pie chart as well along with a dataset
    $intensityPieChart = new PieChart(600, 300);
Exemple #8
-1
function kento_pvc_display($cont)
{
    $kento_pvc_posttype = get_option('kento_pvc_posttype');
    if ($kento_pvc_posttype == NULL) {
        $type = "none";
    } else {
        $type = "";
        foreach ($kento_pvc_posttype as $post_type => $post_type_value) {
            $type .= $post_type . ",";
        }
    }
    if (is_singular(explode(',', $type))) {
        $post_id = get_the_id();
        $cookie_nam = "kentopvc_" . $post_id;
        if (isset($_COOKIE[$cookie_nam])) {
            $visited = "yes";
            $kento_pvc_uniq = get_option('kento_pvc_uniq');
            if (empty($kento_pvc_uniq)) {
                $visited = "no";
            }
        } else {
            ?>
            <script>
			document.cookie="<?php 
            echo $cookie_nam;
            ?>
=yes";
			</script>
            
            <?php 
            $visited = "no";
        }
        if ($visited == "yes") {
        } elseif ($visited == "no") {
            global $wpdb;
            $table = $wpdb->prefix . "kento_pvc";
            $result = $wpdb->get_results("SELECT count FROM {$table} WHERE postid = {$post_id}", ARRAY_A);
            if (empty($result[0]['count'])) {
                $view_count = 0;
            } else {
                $view_count = $result[0]['count'];
            }
            $already_insert = $wpdb->num_rows;
            if ($already_insert > 0) {
                $wpdb->query("UPDATE {$table} SET count = count+1 WHERE postid = '{$post_id}'");
            } else {
                $wpdb->query($wpdb->prepare("INSERT INTO {$table} \r\n\t\t\t\t\t\t\t\t\t\t( id, postid, count )\r\n\t\t\t\t\t\t\t\tVALUES\t( %d, %d, %d )", array('', $post_id, 1)));
            }
            $date = date('Y-m-d', strtotime('+' . get_option('gmt_offset') . ' hour'));
            global $wpdb;
            $table = $wpdb->prefix . "kento_pvc_info";
            $result = $wpdb->get_results("SELECT * FROM {$table} WHERE date = '{$date}' AND postid = {$post_id}", ARRAY_A);
            $already_insert = $wpdb->num_rows;
            if ($already_insert > 0) {
                global $wpdb;
                $table = $wpdb->prefix . "kento_pvc_info";
                $wpdb->query("UPDATE {$table} SET count = count+1 WHERE (date = '{$date}') AND (postid = {$post_id})");
            } else {
                global $wpdb;
                $table = $wpdb->prefix . "kento_pvc_info";
                $wpdb->query($wpdb->prepare("INSERT INTO {$table} \r\n\t\t\t\t\t\t\t\t\t\t( id, postid, count, date )\r\n\t\t\t\t\t\t\t\tVALUES\t( %d, %d, %d, %s)", array('', $post_id, 1, $date)));
            }
            $ip = $_SERVER['REMOTE_ADDR'];
            /*
            
            
            $content = file_get_contents("http://www.geoplugin.net/xml.gp?ip=".$ip);
            preg_match('/<geoplugin_city>(.*)/i', $content, $matches);
            $city = !empty($matches[1]) ? $matches[1] : 0;
            $city = substr($city,0,-17);
            
            if($city == "")
            	{
            	$city = "none";
            	}
            else
            	{
            	$city = $city;
            	}
            	
            	
            	
            preg_match('/<geoplugin_countryName>(.*)/i', $content, $matches);
            $country= !empty($matches[1]) ? $matches[1] : 0;
            $country = substr($country,0,-24);
            
            if($country == ""){
            	$country = "none";}
            else {
            	$country = $country;
            	}
            */
            $geoplugin = new geoPlugin();
            $geoplugin->locate();
            $city = $geoplugin->city;
            $country = $geoplugin->countryName;
            if ($country == "") {
                $country = "none";
            } else {
                $country = $country;
            }
            if ($city == "") {
                $city = "none";
            } else {
                $city = $city;
            }
            global $wpdb;
            $table = $wpdb->prefix . "kento_pvc_city";
            $post_id = get_the_id();
            $datetime = date('Y-m-d H:i:s', strtotime('+' . get_option('gmt_offset') . ' hour'));
            $referer = get_referer($_SERVER["HTTP_REFERER"]);
            $wpdb->query($wpdb->prepare("INSERT INTO {$table} \r\n\t\t\t\t\t\t\t\t( id, postid, ip, city, country, datetime, referer )\r\n\t\t\t\t\t\tVALUES\t( %d, %d, %s, %s, %s, %s, %s)", array('', $post_id, $ip, $city, $country, $datetime, $referer)));
        }
        // end of $visited if
        global $wpdb;
        $table = $wpdb->prefix . "kento_pvc";
        $result = $wpdb->get_results("SELECT count FROM {$table} WHERE postid = {$post_id}", ARRAY_A);
        if (empty($result[0]['count'])) {
            $view_count = 0;
        } else {
            $view_count = $result[0]['count'];
        }
        $kento_pvc_today_text = get_option('kento_pvc_today_text');
        $kento_pvc_total_text = get_option('kento_pvc_total_text');
        if (!empty($kento_pvc_today_text)) {
            $kento_pvc_today_text = $kento_pvc_today_text;
        } else {
            $kento_pvc_today_text = "Views Today ";
        }
        if (!empty($kento_pvc_total_text)) {
            $kento_pvc_total_text = $kento_pvc_total_text;
        } else {
            $kento_pvc_total_text = "Total Views ";
        }
        $cont .= "<div id='kento-pvc'><span class='kento-pvc-total'> " . kento_pvc_convert_lang($view_count) . " " . $kento_pvc_total_text . "</span> <span class='kento-pvc-today'>" . kento_pvc_convert_lang(kento_pvc_today_total()) . " " . $kento_pvc_today_text . "</span>";
        $cont .= "</div>";
        return $cont;
    } else {
        return $cont;
    }
}