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 Link to comment https://forums.phpfreaks.com/topic/290169-web-page-has-a-redirect-loop/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.