mybb user ip problem
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #1
mybb user ip problem
In my forum users ip is same as the server ip.
Any help on how to fix this appreciated.

Thanks.

[Image: banner.png]
04-30-2011 02:19 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: mybb user ip problem
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.

My Blog
04-30-2011 03:23 PM
Find all posts by this user Quote this message in a reply
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #3
RE: mybb user ip problem
I not sure how to do that. It is a shared hosting.
I will glad if you elaborate it a bit..

[Image: banner.png]
04-30-2011 05:32 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: mybb user ip problem
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:
1
2
3
4
5
6
7
8
9
10
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:
1
2
3
4
5
6
7
8
9
10
11
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.


My Blog
04-30-2011 06:41 PM
Find all posts by this user Quote this message in a reply
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #5
RE: mybb user ip problem
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.

[Image: banner.png]
(This post was last modified: 04-30-2011 08:21 PM by techu.)
04-30-2011 07:10 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #6
RE: mybb user ip problem
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...

My Blog
04-30-2011 10:21 PM
Find all posts by this user Quote this message in a reply
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #7
RE: mybb user ip problem
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:
1
2
3
4
5
6
function get_ip()
{
    if(isset($_SERVER['HTTP_X_REAL_IP']))
	{
	$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];
	}


[Image: banner.png]
(This post was last modified: 04-30-2011 10:42 PM by techu.)
04-30-2011 10:41 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: