35
clientipaddress
client_ip_address
SYNOPSIS
client_ip_address()
DESCRIPTION
client_ip_address returns the IP address of the remote host sending the HTTP request.
If PHP is running in CLI mode, client_ip_address returns the local address 127.0.0.1.
CODE
- function client_ip_address() {
- return isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : (PHP_SAPI == 'cli' ? '127.0.0.1' : false); // DON'T TRUST $_SERVER['HTTP_X_FORWARDED_FOR']
- }
Comments