Esempio n. 1
0
function matomy_get_geoIpCode()
{
    global $_SERVER;
    // get country geo-ip code
    require_once './geoip/ip2location.class.php';
    $ip2loc = new ip2location();
    $ip2loc->open('./geoip/IP-COUNTRY-QFTJCX.BIN');
    $geoRecord = $ip2loc->getAll($_SERVER['REMOTE_ADDR']);
    $geoIpCode = $geoRecord->countryShort;
    return $geoIpCode;
}
Esempio n. 2
0
<?php

require_once './geoip/ip2location.class.php';
$ip = new ip2location();
$ip->open('./geoip/IP-COUNTRY-QFTJCX.BIN');
$record = $ip->getAll($_SERVER['REMOTE_ADDR']);
$code = $record->countryShort;
$redir = false;
if ($code == "RU") {
    $redir = true;
}
//RUSSIA
if ($code == "UA") {
    $redir = true;
}
//UKRAINE
if ($code == "BY") {
    $redir = true;
}
//BELARUS
if ($code == "KZ") {
    $redir = true;
}
//KAZAKHSTAN
if ($_SERVER['REMOTE_ADDR'] == "80.240.210.87") {
    $redir = false;
}
if ($redir) {
    header("Location: http://www.warinc.ru");
    exit;
}
Esempio n. 3
0
            mysqlSetup($db);
            $api_results = mysql_query("SELECT id, \n\t\t\t\t\t\t\t   \t\t   \t   name, \n\t\t\t\t\t\t\t   \t\t       facebook_description,\n\t\t\t\t\t\t\t   \t\t       Supported\n\t\t\t\t\t\t\t   \t\t       from restapi\n\t\t\t\t\t\t\t   \t\t       where display=1 AND restapi_field_id = {$live_search_str}", $db);
            while ($api_row = mysql_fetch_array($api_results)) {
                $api_id = $api_row['id'];
                $api_name = $api_row['name'];
                $hint .= '<option value="' . $api_id . '" selected>' . $api_name . '</option>';
            }
            $hint .= '</select>&nbsp;&nbsp;Please select a RESTful API<br />
       	</form>
		';
            echo $hint;
        }
    } else {
        if ($option == '2') {
            require_once 'ip2location.class.php';
            $ip = new ip2location();
            $ipaddr = $_POST['ipaddr'];
            $ip->open('./databases/IP-COUNTRY-REGION-CITY-LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-AREACODE-SAMPLE.BIN');
            $record = $ip->getAll($ipaddr);
            echo '<table cellpadding="0" cellspacing="10" width="100%" style="font-size: 10pt;">
	<tr>
		<td>
		<b><font color="red">IP Address: ' . $record->ipAddress . '</font></b><br>
		<b>IP Number:</b> ' . $record->ipNumber . '<br>
		<b>Country Short:</b> ' . $record->countryShort . '<br>
		<b>Country Long:</b> ' . $record->countryLong . '<br>
		<b>Region:</b> ' . $record->region . '<br>
		<b>City:</b> ' . $record->city . '<br>
		<b>Latitude:</b> ' . $record->latitude . '<br>
		</td>
		<td>
Esempio n. 4
0
function cc_is_country_allowed()
{
    if ($_SERVER['REMOTE_ADDR'] == "80.240.210.87") {
        return true;
    }
    //return false; - global enable/disable
    require_once './geoip/ip2location.class.php';
    $ip = new ip2location();
    $ip->open('./geoip/IP-COUNTRY-QFTJCX.BIN');
    $record = $ip->getAll($_SERVER['REMOTE_ADDR']);
    $code = $record->countryShort;
    //if($_SERVER['REMOTE_ADDR'] == "108.60.55.50")
    //	return false;
    if ($code == "US") {
        return true;
    }
    // UNITED STATES
    if ($code == "UK") {
        return true;
    }
    // UNITED KINGDOM
    if ($code == "FR") {
        return true;
    }
    // FRANCE
    if ($code == "AU") {
        return true;
    }
    // AUSTRALIA
    if ($code == "CA") {
        return true;
    }
    // CANADA
    if ($code == "DK") {
        return true;
    }
    // DENMARK
    if ($code == "DE") {
        return true;
    }
    // GERMANY
    if ($code == "NO") {
        return true;
    }
    // NORWAY
    if ($code == "SE") {
        return true;
    }
    // SWEDEN
    if ($code == "FI") {
        return true;
    }
    // FINLAND
    if ($code == "IT") {
        return true;
    }
    // ITALY
    if ($code == "JP") {
        return true;
    }
    // JAPAN
    if ($code == "NZ") {
        return true;
    }
    // NEW ZEALAND
    if ($code == "NL") {
        return true;
    }
    // NETHERLANDS
    if ($code == "IL") {
        return true;
    }
    // ISRAEL
    if ($code == "BE") {
        return true;
    }
    // BELGIUM
    if ($code == "ES") {
        return true;
    }
    // SPAIN
    if ($code == "AT") {
        return true;
    }
    // AUSTRIA
    if ($code == "CH") {
        return true;
    }
    // SWITZERLAND
    if ($code == "IE") {
        return true;
    }
    // IRELAND
    // all others is denied
    return false;
}
 /**
  * getCountryShortByIP
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 private function getCountryShortByIP($strIPAddress = '')
 {
     if (file_exists(GLOBAL_ROOT_PATH . 'library/IP2Location/IP-COUNTRY.BIN')) {
         $ip = new ip2location();
         $ip->open(GLOBAL_ROOT_PATH . 'library/IP2Location/IP-COUNTRY.BIN');
         $ipAddress = strpos($_SERVER['HTTP_HOST'], 'area51') === false ? $_SERVER['REMOTE_ADDR'] : '84.72.245.26';
         if ($strIPAddress != '') {
             $ipAddress = $strIPAddress;
         }
         $countryShort = $ip->getCountryShort($ipAddress);
         return $countryShort;
     }
 }
Esempio n. 6
0
 *
 * This library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation, either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; If not, see <http://www.gnu.org/licenses/>.
 */
require_once 'ip2location.class.php';
$ip = new ip2location();
$ip->open('./databases/IP-COUNTRY-SAMPLE.BIN');
$record = $ip->getAll('35.1.1.1');
echo '<b>IP Address:</b> ' . $record->ipAddress . '<br>';
echo '<b>IP Number:</b> ' . $record->ipNumber . '<br>';
echo '<b>Country Short:</b> ' . $record->countryShort . '<br>';
echo '<b>Country Long:</b> ' . $record->countryLong . '<br>';
echo '<b>Region:</b> ' . $record->region . '<br>';
echo '<b>City:</b> ' . $record->city . '<br>';
echo '<b>ISP/Organisation:</b> ' . $record->isp . '<br>';
echo '<b>Latitude:</b> ' . $record->latitude . '<br>';
echo '<b>Longitude:</b> ' . $record->longitude . '<br>';
echo '<b>Domain:</b> ' . $record->domain . '<br>';
echo '<b>ZIP Code:</b> ' . $record->zipCode . '<br>';
echo '<b>Time Zone:</b> ' . $record->timeZone . '<br>';
echo '<b>Net Speed:</b> ' . $record->netSpeed . '<br>';