Skip to content

Instantly share code, notes, and snippets.

@phawk
Created January 15, 2012 12:04
Show Gist options
  • Select an option

  • Save phawk/1615627 to your computer and use it in GitHub Desktop.

Select an option

Save phawk/1615627 to your computer and use it in GitHub Desktop.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class MY_Controller extends Controller
{
function MY_Controller()
{
parent::Controller();
$this->auth_logged_in();
}
function auth_logged_in()
{
if ( ! $this->session->userdata('user_id'))
{
// Remember what page the user was on
redirect('/users/login');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment