Skip to content

Instantly share code, notes, and snippets.

@kenjis
Created August 31, 2011 23:56
Show Gist options
  • Save kenjis/1185079 to your computer and use it in GitHub Desktop.
Save kenjis/1185079 to your computer and use it in GitHub Desktop.
CodeIgniter contoller which shows client IP address
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Ip_address extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
//var_dump($_SERVER);
echo $this->input->ip_address();
}
}
/* End of file ip_address.php */
/* Location: ./application/controllers/ip_address.php */
@daronwolff
Copy link

Thanks, it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment