Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added IPv6 support for GeoIP location, while still retaining IPv4 functi... #316

Closed
wants to merge 1 commit into from

Conversation

brianmcardle
Copy link

IPv4 tracking depends on:

  • GEOIP_ADDR
  • GEOIP_CONTINENT_CODE
  • GEOIP_COUNTRY_CODE
  • GEOIP_COUNTRY_NAME

And IPv6 depends on:
GEOIP_ADDR
GEOIP_CONTINENT_CODE_V6
GEOIP_COUNTRY_CODE_V6
GEOIP_COUNTRY_NAME_V6

For the isAvailable() and isWorking() functions, added checks to see if the GEOIP_COUNTRY_CODE_V6 variable has been populated.

For getLocation, if each IPv4 variable is empty, check if the IPv6 equivalent is empty. If not, use the IPv6 equivalent instead.

@@ -150,7 +152,8 @@ public function isAvailable()
}

$available = !empty($_SERVER[self::TEST_SERVER_VAR])
|| !empty($_SERVER[self::TEST_SERVER_VAR_ALT]);
|| !empty($_SERVER[self::TEST_SERVER_VAR_ALT])
|| !empty($_SERVER[self::TEST_SERVER_VAR_ALT.'+_V6']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo here (extra +)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting that.

@mattab
Copy link
Member

mattab commented Jun 15, 2014

Thanks for pull request! I pushed the code without typo in: 4e17f95

I haven't tested the code yet, would you mind test that detection of IPv6 geo location work?

@mattab mattab closed this Jun 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants