Jump to content

IP and countries


shank888

Recommended Posts

Hey all I have a couple questions.

 

First off is I would like to get a users IP address and send it into a MySQL database. is there a function to do this.

 

As well I would like to know if there is a PHP function that will automaticially generate a list of all the countries. I have search but have come up with nothing.

 

and another question lol sorry. I am wanting to use the IP address also to gather the country where the user is from and in a select menu select that country to be picked first for easy registration on my site or w/e. if anyone knows hwo to do that as well that will be really cool :).

 

Thanx

Link to comment
https://forums.phpfreaks.com/topic/104139-ip-and-countries/
Share on other sites

I am wanting to use the IP address also to gather the country where the user is from and in a select menu select that country to be picked first for easy registration on my site.

 

I wont bother so much for such an approach. It wont hurt users to select their country manually.

Link to comment
https://forums.phpfreaks.com/topic/104139-ip-and-countries/#findComment-533224
Share on other sites

A users ip address can be found within the $_SERVER array. $_SERVER['REMOTE_ADDR'].

 

As for the rest of your questions, take a look at the geoip extension.

 

I keep getting this error:

 

Fatal error: Call to undefined function geoip() in : FILENAME CENSORED

 

using:

 

<?php
$record = geoip('http://phpfreaks.com');
if ($record) {
    print_r($record);
}
?> 

Link to comment
https://forums.phpfreaks.com/topic/104139-ip-and-countries/#findComment-536469
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.