Support X-Forwarded-For header in example code

If the X-Forwarded-For header is set display the value from that, otherwise use the IP address given by $_SERVER["REMOTE_ADDR"].