update to ipaddress detection to us getenv() as opposed to $_SERVER[], and added logic for x_forwarded_for addresses.