function detect real ip (updated)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    function updated added filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE) which check if the ip is private
    Advertise your mobile site for FREE with AdTwirl

    Comment


      #17
      function fixed, added trim() to ip check.
      Advertise your mobile site for FREE with AdTwirl

      Comment


        #18
        PHP Code:
         function ip$default null$filter_options 12582912 )
         {
          
        $HTTP_X_FORWARDED_FOR = isset( $_SERVER ) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : getenv'HTTP_X_FORWARDED_FOR' ) ;
          
        $HTTP_X_REAL_IP = isset( $_SERVER ) ? $_SERVER["HTTP_X_REAL_IP"] : getenv'HTTP_X_REAL_IP' ) ;
          
        $HTTP_CLIENT_IP = isset( $_SERVER ) ? $_SERVER["HTTP_CLIENT_IP"] : getenv'HTTP_CLIENT_IP' ) ;
          
        $HTTP_X_CLUSTER_CLIENT_IP = isset( $_SERVER ) ? $_SERVER["HTTP_X_CLUSTER_CLIENT_IP"] : getenv'HTTP_X_CLUSTER_CLIENT_IP' ) ;
          
        $HTTP_X_SUCURI_CLIENTIP = isset( $_SERVER ) ? $_SERVER["HTTP_X_SUCURI_CLIENTIP"] : getenv'HTTP_X_SUCURI_CLIENTIP' ) ;
          
        $HTTP_CF_CONNECTING_IP = isset( $_SERVER ) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : getenv'HTTP_CF_CONNECTING_IP' ) ;
          
        $REMOTE_ADDR = isset( $_SERVER ) ? $_SERVER["REMOTE_ADDR"] : getenv'REMOTE_ADDR' ) ;
          
        $all_ips explode",""$HTTP_X_FORWARDED_FOR,$HTTP_X_REAL_IP,$HTTP_CLIENT_IP,$HTTP_X_CLUSTER_CLIENT_IP,$HTTP_X_SUCURI_CLIENTIP,$HTTP_CF_CONNECTING_IP,$REMOTE_ADDR) ;
          foreach ( 
        $all_ips as $ip ) {
           if ( 
        $ip filter_var$ipFILTER_VALIDATE_IP$filter_options ) )
            break ;
          }
          return 
        $ip $ip $default ;
         } 
        kiss
        Senior Member
        Last edited by kiss; 14.06.19, 14:19.
        www.inbuzunar.mobi - Your mobile portal pocket

        Comment

        Working...
        X