显示客户端IP的详细信息
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
642 B

<?php
$db_path = 'country.db';
$db = new SQLiteDB;
class SQLiteDB extends SQLite3 {
function __construct() {
global $db_path;
$this->open($db_path);
}
}
function get_country($code) {
global $db;
if ($code == null) {
return null;
}
$dat = $db->query('SELECT * FROM main WHERE alpha_2="'.$code.'";')->fetchArray(SQLITE3_ASSOC);
if ($dat) {
$name_dat['en'] = $code." - ".$dat['name_en'];
$name_dat['cn'] = $dat['name_cn'];//."(".$dat['location'].")";
} else {
$name_dat['en'] = $code." - Unknow";
$name_dat['cn'] = null;
}
return $name_dat;
}