this module says that my IP is 80.58.34.42, but this in't correct. This is the IP of the transparent proxy of my ISP.
In Spain, almost all adsl connections are behind a transparent proxy, and if you ban the IP of the proxy instead of the user IP, you will ban many people!!

It is caused because the $_SERVER['REMOTE_ADDR'] variable, is set by the proxy with his own IP, and the user IP is stored in the $_SERVER['HTTP_X_FORWARDED_FOR'] variable.

Explanation and code to solve this are in this web, (it's in spanish,sorry)
http://www.eslomas.com/index.php/archives/2005/04/26/obtencion-ip-real-php/

PS: Sorry for my bad english ;)

CommentFileSizeAuthor
#4 troll_0.module18.57 KBCromicon

Comments

Cromicon’s picture

This is also used by NTL in the UK, one of the largest cable providers.
I've tried switching from 'REMOTE_ADDR' to 'HTTP_X_FORWARDED_FOR' but as yet, the IP in the database still appears to be the one of the proxy.
Is the IP picked up elsewhere?

Cromicon’s picture

Ok, with the help of the original post, I've tested this and it works on new members....

i.e. If I make the alterations to the troll.module as detailed above and create a new user and login, the ip detection is CORRECT.

What needs looking at is updating tables with new IP addresses of users, this blatently is not occurring, however I lack the skill to make this happen.

Implications in the current module include:

Widespread banning of a district based range of people unconnected with the website, ergo potential loss of customer.
No updates on a users IP if they are using a dynamic ISP or if they change their IP.

Cromicon’s picture

Status: Active » Needs work

Yep, that above solution DOES work.

Troll display the FIRST detected IP address next to a username by default. If you click on a users IP address it then displays ALL IP addresses that user has used and the latest one shows correctly if you replaced all 'REMOTE_ADDR' to 'HTTP_X_FORWARDED_FOR'.

I have also tested this from other locations using other suppliers and the detection is perfect. Now if I could figure out CVS I'd post the fix up but there you have it.

Cromicon’s picture

Status: Needs work » Fixed
StatusFileSize
new18.57 KB

It's in the attached file together with the array merge fix. If anyone can add this to the release version I'd be grateful. Thanks very much.

Anonymous’s picture

Status: Fixed » Closed (fixed)