Implemented a secure controller(controllers that need users to login far access ).
Extend the 'Secure_controller' instead of 'CI_Controller'.

Note: the Secure_Controller class uses a session variable named 'logged_in' to check whether the user is logged in or not, if unsuccessful it redirects the user to 'login' controller.  Login guys make note of this. You will have to set the same variable to true while login.