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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.