Page 1 of 1

IP address

Posted: Wed Jul 29, 2009 3:57 pm
by editpoint
Script URL:
Version of script:1.6
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:entries.txt, blank entries, banned ip

Write your message below:
Hi
When looking at the entries.txt file or when i sign into the guestbook and check View IP all the entries have the same IP address. Every now and then this ip addresss appears in banned_ip.txt. Resulting in a blank questbook. I have included the line in gbook.php to allow the IP address but why have all the entires got the same address?

The address is 10.1.6.1

Thanks

Posted: Wed Jul 29, 2009 4:03 pm
by Klemen
Must be a server-side setting overriding all IP addresses. 10.1.6.1 is a local IP (from the reserved private (intranet) range), not an internet-one.

Posted: Thu Jul 30, 2009 9:27 am
by editpoint
Ok Thanks but what does that mean:-) ? Why would my server be changing the ip address? I have another site which uses guestbook and the entries in there have different ip addresses.

Could it be virus/trojan related?

Posted: Thu Jul 30, 2009 10:15 am
by Henrie
The GBook logs the value returned by _SERVER["REMOTE_ADDR"]
Probably your server somehow returns its internal IP like maybe given by _SERVER["SERVER_ADDR"]
You can check if this is true if you have phpinfo.php file on your server. See the link for download in this topic viewtopic.php?t=83

I don't think it is a virus/trojan, just some strange configuration of the server.

Greetings,
Henrie

Posted: Fri Jul 31, 2009 12:36 pm
by editpoint
Yes using phpinfo _SERVER["REMOTE_ADDR"] is 10.1.6.1 and _SERVER["REMOTE_ADDR"] is 10.1.6.102.

So, is this normal? if it is i dont see the point of being able to view an IP address or ban an ip because you are effectively banning yourself.

Bit confused!!

Posted: Fri Jul 31, 2009 1:45 pm
by Klemen
It's not normal and it is a server-side issue. Talk to with your host why a local IP is listed in PHP variable $_SERVER['REMOTE_ADDR'] instead of the actual one.

There really is nothing we can help here. It's a server issue and your host must fix it. It has nothing to do with GBook code.

Posted: Fri Jul 31, 2009 5:00 pm
by DC
That is odd I have never seen that problem and no way that's normal, as I have dealt with a lot of servers, and never once came across that issue. I would notify them ASAP as Klem has said, and have them fix it ... do not let them tell you that its normal. I say this as some hosts like you to think they are right and the user is wrong, if they say something like that send them to this thread.

I have proven many a server company wrong even though they may try to say they are correct, so I am always prepared for some far out incorrect answer that they may try to justify.

My hope is they will just fix the issue for you.

DC

Posted: Fri Jul 31, 2009 5:28 pm
by editpoint
Ok.

Thanks a lot for your help. I'll get in touch with my ISP

Posted: Fri Aug 07, 2009 11:03 am
by editpoint
Hi. back again!

My ISP has responded thus:
The development team have set up a script under guestbook
called test.php which will show you the variables that can
be used.

you will need to use:

HTTP_X_FORWARDED_FOR

to record the remote IP address.

Does that make sense? Does this mean I will have to edit the script?

Posted: Fri Aug 07, 2009 4:04 pm
by Klemen
Can you upload the phpinfo.php file (it's in the first post in the forum) to your server and post a link to it here so I can check what variables exactly are set on your server?

Posted: Fri Aug 07, 2009 8:24 pm
by editpoint

Posted: Fri Aug 07, 2009 9:34 pm
by Klemen
OK, shouldn't be a problem.

Open gbook.php in Notepad and change REMOTE_ADDR to HTTP_X_FORWARDED_FOR (twice in the gbook.php file).

Don't change anything else in gbook.php.

Also in your settings.php file make sure variable $settings['ignore_proxies'] is set to 1.

Upload both modified files, close all browser windows then open your guestbook and test it.

Note that existing posts won't be affected, but IP should be shown correctly for new posts from now on.

Posted: Sat Aug 08, 2009 8:13 pm
by editpoint
Hi
Thanks a lot. Excellent support!

That seems to work OK with a couple of test entries.

Now hopefully i can ban that pesky person who keeps leaving rubbish in my guestbook.