Jump to content

shvikr

New Members
  • Posts

    1
  • Joined

  • Last visited

shvikr's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, Am working on hooks wit codeigniter, am getting an error after applying hooks like "This webpage has a redirect loop". My hooks.php file : $hook['post_controller_constructor'] = array( 'class' => 'SessionData', 'function' => 'initializeData', 'filename' => 'auth.php', 'filepath' => 'hooks', 'params' => array() ); auth.php file: <?php class SessionData{ var $CI; function __construct(){ $this->CI =& get_instance(); if(!isset($this->CI->session)) $this->CI->load->library('session'); } function initializeData() { if(!$this->CI->session->userdata('admin_id')){ redirect('admin'); } } } ?> Admin controller file: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Admin extends CI_Controller { public function index() { $this->load->view('admin/login'); } I need to redirect all calls to admin log in page if the admin is not logged in. Why am getting this error? Please help. Thanks
×
×
  • 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.