2016-01-16, 12:56 AM
Hello MyBB,
So this is going to be a odd question.. Now this has been an issues for almost a year now, when I first started my forum. It is now near completion and I am trying to finish the odds and ends I left for later.
First off, my forum is for my xbox clan and my minecraft server, so I m running it off of a virtual machine with XAMPP. I have everything working alright but the IP. At first the IP's were all the same, coming up to the local address, 10.0.2.2, and then I was reading online trying to find new get_ip codes thinking that was the issue. After a few days trying to figure it out, I just added more IP registration allowed in a day for the time being. Today I am back at it and tryign to find solutions. I read online that it was supposed to be a init.php issue or something and I should put the following code under <?php
Code:
But all that did was put a big gap on the header of my forum. I tried placing this code a bit lower on and it didnt change anything BUT, the IP changed from 10.0.2.2 to, "unknown" So I am assuming I am somewhat on the right track? My get_ip code from the functions.php goes as followed:
Code:
Also, yes my "Scrutinize User's IP address?" is at yes and first option is at auto. That was the first thing I tried.
Thank you.
So this is going to be a odd question.. Now this has been an issues for almost a year now, when I first started my forum. It is now near completion and I am trying to finish the odds and ends I left for later.
First off, my forum is for my xbox clan and my minecraft server, so I m running it off of a virtual machine with XAMPP. I have everything working alright but the IP. At first the IP's were all the same, coming up to the local address, 10.0.2.2, and then I was reading online trying to find new get_ip codes thinking that was the issue. After a few days trying to figure it out, I just added more IP registration allowed in a day for the time being. Today I am back at it and tryign to find solutions. I read online that it was supposed to be a init.php issue or something and I should put the following code under <?php
Code:
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];
But all that did was put a big gap on the header of my forum. I tried placing this code a bit lower on and it didnt change anything BUT, the IP changed from 10.0.2.2 to, "unknown" So I am assuming I am somewhat on the right track? My get_ip code from the functions.php goes as followed:
Code:
function get_ip()
{
global $mybb, $plugins;
$ip = strtolower($_SERVER['REMOTE_ADDR']);
if($mybb->settings['ip_forwarded_check'])
{
$addresses = array();
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$addresses = explode(',', strtolower($_SERVER['HTTP_X_FORWARDED_FOR']));
}
elseif(isset($_SERVER['HTTP_X_REAL_IP']))
{
$addresses = explode(',', strtolower($_SERVER['HTTP_X_REAL_IP']));
}
if(is_array($addresses))
{
foreach($addresses as $val)
{
$val = trim($val);
// Validate IP address and exclude private addresses
if(my_inet_ntop(my_inet_pton($val)) == $val && !preg_match("#^(10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.|192\.168\.|fe80:|fe[c-f][0-f]:|f[c-d][0-f]{2}:)#", $val))
{
$ip = $val;
break;
}
}
}
}
if(!$ip)
{
if(isset($_SERVER['HTTP_CLIENT_IP']))
{
$ip = strtolower($_SERVER['HTTP_CLIENT_IP']);
}
}
if($plugins)
{
$ip_array = array("ip" => &$ip); // Used for backwards compatibility on this hook with the updated run_hooks() function.
$plugins->run_hooks("get_ip", $ip_array);
}
return $ip;
}
Also, yes my "Scrutinize User's IP address?" is at yes and first option is at auto. That was the first thing I tried.
Thank you.