llms_get_ip_address()
Retrieve an IP Address for the current user
Description Description
Return Return
(string)
Source Source
File: includes/llms.functions.core.php
function llms_get_ip_address() { if ( isset( $_SERVER['X-Real-IP'] ) ) { return $_SERVER['X-Real-IP']; } elseif ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { // Proxy servers can send through this header like this: X-Forwarded-For: client1, proxy1, proxy2 // Make sure we always only send through the first IP in the list which should always be the client IP. return trim( current( explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) ); } elseif ( isset( $_SERVER['REMOTE_ADDR'] ) ) { return $_SERVER['REMOTE_ADDR']; } return ''; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: