Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getNetwork()
- {
- // It should be noted that this function is designed specifically for getting the local / wan name for Plex.
- global $domain_name;
- global $plex_server_ip;
- $clientIP = get_client_ip();
- if ($clientIP == $plex_server_ip):
- $network = 'http://' . $plex_server_ip;
- else:
- $network = 'http://' . $domain_name;
- endif;
- return $network;
- }
- function get_client_ip()
- {
- if (isset($_SERVER["REMOTE_ADDR"])) {
- $ipaddress = $_SERVER["REMOTE_ADDR"];
- } else if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
- $ipaddress = $_SERVER["HTTP_X_FORWARDED_FOR"];
- } else if (isset($_SERVER["HTTP_CLIENT_IP"])) {
- $ipaddress = $_SERVER["HTTP_CLIENT_IP"];
- }
- return $ipaddress;
- }
Advertisement
Add Comment
Please, Sign In to add comment