shvikr Posted July 29, 2014 Share Posted July 29, 2014 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 Quote Link to comment https://forums.phpfreaks.com/topic/290169-web-page-has-a-redirect-loop/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.