[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/utilities/src/ -> IpHelper.php (summary)

Part of the Joomla Framework Utilities Package

Copyright: Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 579 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 11 functions

  __construct()
  getIp()
  setIp()
  isIPv6()
  IPinList()
  workaroundIPIssues()
  setAllowIpOverrides()
  detectAndCleanIP()
  detectIP()
  inetToBits()
  checkIPv6CIDR()

Functions
Functions that are not part of a class:

__construct()   X-Ref
Private constructor to prevent instantiation of this class


getIp()   X-Ref
Get the current visitor's IP address

return: string

setIp($ip)   X-Ref
Set the IP address of the current visitor

param: string  $ip  The visitor's IP address
return: void

isIPv6($ip)   X-Ref
Is it an IPv6 IP address?

param: string   $ip  An IPv4 or IPv6 address
return: boolean

IPinList($ip, $ipTable = '')   X-Ref
Checks if an IP is contained in a list of IPs or IP expressions

param: string        $ip       The IPv4/IPv6 address to check
param: array|string  $ipTable  An IP expression (or a comma-separated or array list of IP expressions) to check against
return: boolean

workaroundIPIssues()   X-Ref
Works around the REMOTE_ADDR not containing the user's IP

return: void

setAllowIpOverrides($newState)   X-Ref
Should I allow the remote client's IP to be overridden by an X-Forwarded-For or Client-Ip HTTP header?

param: boolean  $newState  True to allow the override
return: void

detectAndCleanIP()   X-Ref
Gets the visitor's IP address.

Automatically handles reverse proxies reporting the IPs of intermediate devices, like load balancers. Examples:

- https://www.akeebabackup.com/support/admin-tools/13743-double-ip-adresses-in-security-exception-log-warnings.html
- https://stackoverflow.com/questions/2422395/why-is-request-envremote-addr-returning-two-ips

The solution used is assuming that the last IP address is the external one.

return: string

detectIP()   X-Ref
Gets the visitor's IP address

return: string

inetToBits($inet)   X-Ref
Converts inet_pton output to bits string

param: string  $inet  The in_addr representation of an IPv4 or IPv6 address
return: string

checkIPv6CIDR($ip, $cidrnet)   X-Ref
Checks if an IPv6 address $ip is part of the IPv6 CIDR block $cidrnet

param: string  $ip       The IPv6 address to check, e.g. 21DA:00D3:0000:2F3B:02AC:00FF:FE28:9C5A
param: string  $cidrnet  The IPv6 CIDR block, e.g. 21DA:00D3:0000:2F3B::/64
return: boolean



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer