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
71ef30d35e
commit
b5bbae62b0
@ -189,14 +189,14 @@ clearstatcache();
|
||||
if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
|
||||
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/>
|
||||
Your IP is:<br /><b>' . $_SERVER['REMOTE_ADDR'] . '</b>', true);
|
||||
Your IP is:<br /><b>' . get_browser_real_ip() . '</b>', true);
|
||||
}
|
||||
else {
|
||||
$file_content = trim(file_get_contents(BASE . 'install/ip.txt'));
|
||||
$allow = false;
|
||||
$listIP = preg_split('/\s+/', $file_content);
|
||||
foreach($listIP as $ip) {
|
||||
if($_SERVER['REMOTE_ADDR'] == $ip) {
|
||||
if(get_browser_real_ip() == $ip) {
|
||||
$allow = true;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class Forum
|
||||
'post_smile' => 0, 'post_html' => 1,
|
||||
'post_date' => time(),
|
||||
'last_edit_aid' => 0, 'edit_date' => 0,
|
||||
'post_ip' => $_SERVER['REMOTE_ADDR']
|
||||
'post_ip' => get_browser_real_ip()
|
||||
))) {
|
||||
$thread_id = $db->lastInsertId();
|
||||
$db->query("UPDATE `" . FORUM_TABLE_PREFIX . "forum` SET `first_post`=".(int) $thread_id." WHERE `id` = ".(int) $thread_id);
|
||||
@ -93,7 +93,7 @@ class Forum
|
||||
'post_smile' => $smile,
|
||||
'post_html' => $html,
|
||||
'post_date' => time(),
|
||||
'post_ip' => $_SERVER['REMOTE_ADDR']
|
||||
'post_ip' => get_browser_real_ip()
|
||||
));
|
||||
}
|
||||
public static function add_board($name, $description, $access, $guild, &$errors)
|
||||
|
@ -33,7 +33,7 @@ class Visitors
|
||||
$this->sessionTime = $sessionTime;
|
||||
$this->cleanVisitors();
|
||||
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$ip = get_browser_real_ip();
|
||||
if($this->visitorExists($ip))
|
||||
$this->updateVisitor($ip, $_SERVER['REQUEST_URI']);
|
||||
else
|
||||
|
@ -74,7 +74,7 @@ else
|
||||
else
|
||||
$tmp = array();
|
||||
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$ip = get_browser_real_ip();
|
||||
$t = isset($tmp[$ip]) ? $tmp[$ip] : NULL;
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ if($config['account_country_recognize']) {
|
||||
$country_recognized = $country_session;
|
||||
}
|
||||
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'])) {
|
||||
$country_recognized = strtolower($info['country']);
|
||||
setSession('country', $country_recognized);
|
||||
|
@ -65,7 +65,7 @@ if(Forum::canPost($account_logged))
|
||||
}
|
||||
if (count($errors) == 0) {
|
||||
$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() . "', '" . (int)$char_id . "', " . $db->quote($text) . ", " . $db->quote($post_topic) . ", '" . (int)$smile . "', '" . (int)$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() . "', '" . (int)$char_id . "', " . $db->quote($text) . ", " . $db->quote($post_topic) . ", '" . (int)$smile . "', '" . (int)$html . "', '" . time() . "', '0', '0', '" . get_browser_real_ip() . "')");
|
||||
$thread_id = $db->lastInsertId();
|
||||
$db->query("UPDATE `" . FORUM_TABLE_PREFIX . "forum` SET `first_post`=" . (int)$thread_id . " WHERE `id` = " . (int)$thread_id);
|
||||
header('Location: ' . getForumThreadLink($thread_id));
|
||||
|
Loading…
x
Reference in New Issue
Block a user