mirror of
https://github.com/typecho/typecho.git
synced 2025-01-17 04:28:17 +01:00
增加新常量 __TYPECHO_IP_SOURCE__
用来指定从哪个项里读取IP地址,比如HTTP_X_REAL_IP
This commit is contained in:
parent
3041d50461
commit
07f93cb76b
@ -621,8 +621,8 @@ class Typecho_Request
|
||||
$this->_ip = $ip;
|
||||
} else {
|
||||
switch (true) {
|
||||
case NULL !== $this->getServer('HTTP_X_FORWARDED_FOR'):
|
||||
list($this->_ip) = array_map('trim', explode(',', $this->getServer('HTTP_X_FORWARDED_FOR')));
|
||||
case defined('__TYPECHO_IP_SOURCE__') && NULL !== $this->getServer(__TYPECHO_IP_SOURCE__):
|
||||
list($this->_ip) = array_map('trim', explode(',', $this->getServer(__TYPECHO_IP_SOURCE__)));
|
||||
break;
|
||||
case NULL !== $this->getServer('HTTP_CLIENT_IP'):
|
||||
$this->_ip = $this->getServer('HTTP_CLIENT_IP');
|
||||
|
Loading…
x
Reference in New Issue
Block a user