mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 09:19:22 +02:00
Prefer get_browser_real_ip() over REMOTE_ADDR
This commit is contained in:
parent
a4a2480995
commit
941846605c
@ -183,14 +183,14 @@ clearstatcache();
|
|||||||
if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
|
if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
|
||||||
if(!file_exists(BASE . 'install/ip.txt')) {
|
if(!file_exists(BASE . 'install/ip.txt')) {
|
||||||
$content = warning('AAC installation is disabled. To enable it make file <b>ip.txt</b> in install/ directory and put there your IP.<br/>
|
$content = warning('AAC installation is disabled. To enable it make file <b>ip.txt</b> in install/ directory and put there your IP.<br/>
|
||||||
Your IP is:<br /><b>' . $_SERVER['REMOTE_ADDR'] . '</b>', true);
|
Your IP is:<br /><b>' . get_browser_real_ip() . '</b>', true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$file_content = trim(file_get_contents(BASE . 'install/ip.txt'));
|
$file_content = trim(file_get_contents(BASE . 'install/ip.txt'));
|
||||||
$allow = false;
|
$allow = false;
|
||||||
$listIP = preg_split('/\s+/', $file_content);
|
$listIP = preg_split('/\s+/', $file_content);
|
||||||
foreach($listIP as $ip) {
|
foreach($listIP as $ip) {
|
||||||
if($_SERVER['REMOTE_ADDR'] == $ip) {
|
if(get_browser_real_ip() == $ip) {
|
||||||
$allow = true;
|
$allow = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
|
|||||||
{
|
{
|
||||||
$content = warning('In file <b>install/ip.txt</b> must be your IP!<br/>
|
$content = warning('In file <b>install/ip.txt</b> must be your IP!<br/>
|
||||||
In file is:<br /><b>' . nl2br($file_content) . '</b><br/>
|
In file is:<br /><b>' . nl2br($file_content) . '</b><br/>
|
||||||
Your IP is:<br /><b>' . $_SERVER['REMOTE_ADDR'] . '</b>', true);
|
Your IP is:<br /><b>' . get_browser_real_ip() . '</b>', true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ob_start();
|
ob_start();
|
||||||
|
@ -331,7 +331,7 @@ if(setting('core.account_country_recognize')) {
|
|||||||
$country_recognized = $country_session;
|
$country_recognized = $country_session;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$info = json_decode(@file_get_contents('http://ipinfo.io/' . $_SERVER['REMOTE_ADDR'] . '/geo'), true);
|
$info = json_decode(@file_get_contents('http://ipinfo.io/' . get_browser_real_ip() . '/geo'), true);
|
||||||
if(isset($info['country'])) {
|
if(isset($info['country'])) {
|
||||||
$country_recognized = strtolower($info['country']);
|
$country_recognized = strtolower($info['country']);
|
||||||
setSession('country', $country_recognized);
|
setSession('country', $country_recognized);
|
||||||
|
@ -95,7 +95,7 @@ if(Forum::canPost($account_logged)) {
|
|||||||
if (count($errors) == 0) {
|
if (count($errors) == 0) {
|
||||||
$saved = true;
|
$saved = true;
|
||||||
|
|
||||||
$db->query("INSERT INTO `" . FORUM_TABLE_PREFIX . "forum` (`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile`, `post_html` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('0', '" . time() . "', '" . (int)$section_id . "', '0', '0', '" . $account_logged->getId() . "', '" . $char_id . "', " . $db->quote($text) . ", " . $db->quote($post_topic) . ", '" . $smile . "', '" . $html . "', '" . time() . "', '0', '0', '" . $_SERVER['REMOTE_ADDR'] . "')");
|
$db->query("INSERT INTO `" . FORUM_TABLE_PREFIX . "forum` (`first_post` ,`last_post` ,`section` ,`replies` ,`views` ,`author_aid` ,`author_guid` ,`post_text` ,`post_topic` ,`post_smile`, `post_html` ,`post_date` ,`last_edit_aid` ,`edit_date`, `post_ip`) VALUES ('0', '" . time() . "', '" . (int)$section_id . "', '0', '0', '" . $account_logged->getId() . "', '" . $char_id . "', " . $db->quote($text) . ", " . $db->quote($post_topic) . ", '" . $smile . "', '" . $html . "', '" . time() . "', '0', '0', '" . get_browser_real_ip() . "')");
|
||||||
|
|
||||||
$thread_id = $db->lastInsertId();
|
$thread_id = $db->lastInsertId();
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class Forum
|
|||||||
'post_smile' => 0, 'post_html' => 1,
|
'post_smile' => 0, 'post_html' => 1,
|
||||||
'post_date' => time(),
|
'post_date' => time(),
|
||||||
'last_edit_aid' => 0, 'edit_date' => 0,
|
'last_edit_aid' => 0, 'edit_date' => 0,
|
||||||
'post_ip' => $_SERVER['REMOTE_ADDR']
|
'post_ip' => get_browser_real_ip()
|
||||||
))) {
|
))) {
|
||||||
$thread_id = $db->lastInsertId();
|
$thread_id = $db->lastInsertId();
|
||||||
$db->query("UPDATE `" . FORUM_TABLE_PREFIX . "forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);
|
$db->query("UPDATE `" . FORUM_TABLE_PREFIX . "forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);
|
||||||
@ -94,7 +94,7 @@ class Forum
|
|||||||
'post_smile' => $smile,
|
'post_smile' => $smile,
|
||||||
'post_html' => $html,
|
'post_html' => $html,
|
||||||
'post_date' => time(),
|
'post_date' => time(),
|
||||||
'post_ip' => $_SERVER['REMOTE_ADDR']
|
'post_ip' => get_browser_real_ip()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
public static function add_board($name, $description, $access, $guild, &$errors)
|
public static function add_board($name, $description, $access, $guild, &$errors)
|
||||||
|
@ -37,7 +37,7 @@ class Visitors
|
|||||||
$this->sessionTime = $sessionTime;
|
$this->sessionTime = $sessionTime;
|
||||||
$this->cleanVisitors();
|
$this->cleanVisitors();
|
||||||
|
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
$ip = get_browser_real_ip();
|
||||||
$userAgentShortened = substr($_SERVER['HTTP_USER_AGENT'] ?? 'unknown', 0, 255);
|
$userAgentShortened = substr($_SERVER['HTTP_USER_AGENT'] ?? 'unknown', 0, 255);
|
||||||
|
|
||||||
if($this->visitorExists($ip))
|
if($this->visitorExists($ip))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user