• File: functions.php
  • Full Path: /home/sema-files/web/semafiles.configured.cc/public_html/pge/setting/functions.php
  • Date Modified: 09/23/2025 5:34 AM
  • File size: 460 bytes
  • MIME-type: text/x-php
  • Charset: utf-8
<?php 

function get_client_ip() {
    $client  = @$_SERVER['HTTP_CLIENT_IP'];
    $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
    $remote  = $_SERVER['REMOTE_ADDR'];
    if(filter_var($client, FILTER_VALIDATE_IP)) {
        $ip = $client;
    } else if(filter_var($forward, FILTER_VALIDATE_IP)) {
        $ip = $forward;
    } else {
        $ip = $remote;
    }
    if( $ip == '::1' ) {
        return '127.0.0.1';
    }
    return  $ip;
}