Re: Client's IP address retrival



>> If say you wanted to ban users from a particular IP then I wouldn't
>> trust this method, but if you just want the IP for cosmetic reasons
>> then I'm sure you can live with the pitfalls.
>
>could you can do it with php....
>this may not work with annonymous proxies...

It also won't work with non-proxies operated by users annoying
enough that you want to ban them (if the reason for getting the IP
is to ban someone). It's easy enough for someone to add a fake
header, especially if they are using telnet (or CURL) as a browser.
Or, they can set up their own proxy on their own machine, rigged
to send a fake HTTP_X_FORWARDED_FOR header.

If you are trying to track abuse, you should at least log *BOTH* of
these variables. If the user is abusive, HTTP_X_FORWARDED_FOR
can be a complete fake. REMOTE_ADDR at least gives you an idea
of which ISP to complain to if the problem gets serious enough.

>but most ISP's should forward this header.
>
>if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
>{
> $userip = $_SERVER['HTTP_X_FORWARDED_FOR'];
>}
>else
>{
> $userip = $_SERVER['REMOTE_ADDR'];
>}

Gordon L. Burditt
.



Relevant Pages

  • Re: faked emails with an ip address? is it possible
    ... >>I am working for a company and need to validate if this is possible. ... >>sent emails from like yahoo or hotmail or some email provider to ... By abusing an open relay you can fake any header. ...
    (comp.security.misc)
  • Re: [SLE] Spam emails in the suse-linux-e
    ... > this list, and they do, by using a fake or timed From: header. ... We have commented this several times, and it seems that the only MUA ... capable of doing that is "mutt". ...
    (SuSE)
  • RE: [Full-Disclosure] Empty emails example
    ... The last Received line is definitely fake. ... >different relay points). ... That header is most probably fake. ... those boxes are plain windows clients not running any mailserver. ...
    (Full-Disclosure)
  • Re: My post has been canceled
    ... How does anybody manage to ban certain newsgroup members? ... People can't change ALL of the information in a message header. ... few fields that are added by the servers by which the post comes to you. ...
    (borland.public.delphi.non-technical)