Welcome Guest, Not a member yet? Register   Sign In
if session true redirect to dashboard
#1

[eluser]Calebe Aires[/eluser]
How to redirect user for dashboard if he is logged, ( WHEN HE TRIE TO ACCESS THE LOGIN PAGE)?

I have tried this, but it dont work!
Code:
class Entrar extends Controller {
    
    function __construct() {
        parent::Controller();
        $this->load->model('conta_model');

    }

    function index()
    {

        $data['conteudo'] = 'site/entrar';
        $this->load->view('includes/conteudo', $data);
        $this->conectado();  // THIS VERIFY IF USER IS LOGGED, THEN, IF YES, REDIRECT TO DASHBOARD
    

    }

    function conectado(){
        
        $conectado = $this->session->userdata('conectado');
        if(isset($conectado)) {
            
            redirect('/dashboard');


        }else{
            
            die();
                        
        }

    }
    
    function desconectar() {

        $this->session->sess_destroy();
        redirect('/entrar', 'refresh');
        die();

    }

}


Messages In This Thread
if session true redirect to dashboard - by El Forum - 09-23-2010, 04:28 PM
if session true redirect to dashboard - by El Forum - 09-23-2010, 05:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB