The best way to determine what environment variables are available on your server setup is to create a page that calls the built-in function phpinfo(). The output of this function displays a list of all available environment variables, as well as all variables available from the server interface API (e.g. ISAPI or Apache). The variables available to you will be drastically reduced if you use the CGI version of PHP.
In order to not concern about how the server sets this up, how do we write codes in a script to check $REMOTE_HOST or $REMOTE_ADDR or both to get the correct IP address of someone viewing your page?
Thanks in advance.
Ok, I've tried $REMOTE_HOST and $REMOTE_ADDR both locally and on my server. Both do not work. $REMOTE_HOST on both give me nothing, and $REMOTE_ADDR on both give me the local IP.
As for $HTTP_X_FORWARDED_FOR Camikaze, this gives me two IP addresses.
From looking at mine I know the first one is mine. Where does the second one come into things. I know the second one is very similar to my ISP's server IP. Would this be the IP of the server requesting the page?
If this is true then, I can just get the string position of the comma and then select everything up to that comma using substr. However there is probably a more economical way of doing this.