MyBB Hacks

Full Version: mybb user ip problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In my forum users ip is same as the server ip.
Any help on how to fix this appreciated.

Thanks.
Your server possibly is using an internal proxy.
You'll need to figure out what it is (eg a lighttpd frontend -> Apache backend?) and according override the REMOTE_IP variable.
I not sure how to do that. It is a shared hosting.
I will glad if you elaborate it a bit..
Is this the forum in your signature?  If so, it looks possible that there may be a proxy, though I can't really tell.

GET /

Code:
HTTP/1.1 404 Not Found
Server: nginx admin
Date: Sat, 30 Apr 2011 08:31:35 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.2.9
Set-Cookie: mybb[lastactive]=1304152295; expires=Sun, 29-Apr-2012 08:31:35 GMT; path=/; domain=.techedze.com
Content-Encoding: gzip


GET /jscripts/popup_menu.js?ver=1600

Code:
HTTP/1.1 200 OK
Server: nginx admin
Date: Sat, 30 Apr 2011 08:31:37 GMT
Content-Type: application/x-javascript
Last-Modified: Sun, 17 Apr 2011 22:06:04 GMT
Connection: keep-alive
Vary: Accept-Encoding
Expires: Sat, 07 May 2011 08:31:37 GMT
Cache-Control: max-age=604800
X-Cache: HIT from Backend
Content-Length: 2755


IDK what "X-Cache" there refers to, but might be a hint.

Ask your host for further details on whether they're using a proxy to handle PHP/CGI requests, and ask them what header contains the "real" IP.  From memory, nginx, by default, uses X-Real-IP I think, so if your host is using that, you'd edit inc/init.php, and put, after "<?php":

PHP Code:
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];


I can't really give you any more info - you'll need to question your host for their setup and how to fix.

yes that is the forum.
Thanks for the help..


I asked my host they said
Quote:The Server is running as Nginx Server in front-end and Apache Server is running at Back-end.

I was getting an error undeclared T_VARIABLE if I put this $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP']; at the start of init.php.

So I modified the function.php and included the line at the start of get_ip function.

Every thing is working fine now.
Thanks again.
I'm somewhat surprised about that.
Sticking it at the top of init.php will show an error of there's a problem.  Putting it in functions.php will hide the error, but shouldn't fix the problem.
Oh well...
I actually copy pasted the code that you provided but I got error in init.php but the same thing worked fine in function.php.

Code:
function get_ip()
{
    if(isset($_SERVER['HTTP_X_REAL_IP']))
	{
	$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];
	}

Reference URL's