ip 기록
This commit is contained in:
+1
-1
@@ -1047,7 +1047,7 @@ function increaseRefresh($type = "", $cnt = 1)
|
|||||||
|
|
||||||
$logDB = FileDB::db($logPath, $serverPath . '/../f_install/sql/api_log.sql');
|
$logDB = FileDB::db($logPath, $serverPath . '/../f_install/sql/api_log.sql');
|
||||||
|
|
||||||
$ip = $_SERVER['REMOTE_ADDR'] ?? 'local';
|
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? 'local';
|
||||||
$date = date('Y-m-d H:i:s');
|
$date = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
$logDB->insert('api_log', [
|
$logDB->insert('api_log', [
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class APIHelper
|
|||||||
$logPath = "{$rootPath}/d_log/{$realYearMonth}_api_log.db";
|
$logPath = "{$rootPath}/d_log/{$realYearMonth}_api_log.db";
|
||||||
}
|
}
|
||||||
$logDB = FileDB::db($logPath, __DIR__ . '/../../f_install/sql/api_log.sql');
|
$logDB = FileDB::db($logPath, __DIR__ . '/../../f_install/sql/api_log.sql');
|
||||||
$ip = $_SERVER['REMOTE_ADDR'] ?? 'local';
|
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? 'local';
|
||||||
$date = date('Y-m-d H:i:s');
|
$date = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
//NOTE: array_merge([], {})의 상황이 가능함.
|
//NOTE: array_merge([], {})의 상황이 가능함.
|
||||||
|
|||||||
+1
-19
@@ -947,31 +947,13 @@ class Util
|
|||||||
return $flattened;
|
return $flattened;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the IP address of the client.
|
|
||||||
*
|
|
||||||
* @param boolean $trust_proxy_headers Whether or not to trust the
|
|
||||||
* proxy headers HTTP_CLIENT_IP
|
|
||||||
* and HTTP_X_FORWARDED_FOR. ONLY
|
|
||||||
* use if your server is behind a
|
|
||||||
* proxy that sets these values
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function get_client_ip($trust_proxy_headers = false)
|
public static function get_client_ip($trust_proxy_headers = false)
|
||||||
{
|
{
|
||||||
if (!$trust_proxy_headers) {
|
if (!$trust_proxy_headers) {
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
return $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
return $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? 'local';
|
||||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
|
||||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
|
||||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
|
||||||
} else {
|
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ip;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user