Login verification always this same redirect

Posted by user1738013 on Stack Overflow See other posts from Stack Overflow or by user1738013
Published on 2012-10-29T16:58:39Z Indexed on 2012/10/29 17:00 UTC
Read the original article Hit count: 107

Filed under:
|

This is my code:

session_helper

if ( ! function_exists('is_login'))
{
    function is_login()
    {
        $CI =& get_instance();

        $is_logged_in = $CI->session->userdata('is_logged_in');

        if (!isset($is_logged_in) || $is_logged_in != TRUE) { 

            redirect('login');

        }               
    }   
}

check_login

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

class Check_login extends CI_Controller {

    function __construct()
    {
            parent::__construct();
            $this->is_logged_in();  
    }

    function is_logged_in()
    {
        $this->load->helper('session_helper');
                $this->load->helper('url');

        is_login();
    }       
} 

When I induction this function:
Every time is induction redirect('login');

Where is my problem?

© Stack Overflow or respective owner

Related posts about login

Related posts about checking