Masoud Tavakkoli Masoud Tavakkoli - 7 months ago 37
PHP Question

hooks didn't load in codeigniter

I'm new in codeigniter, I want 2 page with the name of "login" and "admin"
i use hook and session to detect user is logged in or not, but unfortunately hook didn't load (Call) at all.
any idea?

My controller :

defined('BASEPATH') OR exit('No direct script access allowed');

class Auth extends CI_Controller{

public function __construct(){

public function index(){


My hook :

<?php if ( !defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );

class Auth_hook {

protected $CI;

public function __construct() {
$this->CI =& get_instance();

public function index(){

EDIT: And finally



Try this :


Instead of this :