• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Blank Screen using sessions...

#1
[eluser]jenie_net[/eluser]
Hi all!

I've got a controller Login.php
Code:
<?php

class Login extends MY_Controller {

    function Login()
    {
        parent::MY_Controller();
        $this->load->helper('security');
        $this->load->helper('form');
        $this->load->model('User_model');
    }
    
    function index()
    {
        $this->_header_ajax('Authentication required:');
        $this->load->view('public/login_view');
        $this->_footer();
    }


    function authenticate(){
        $data = array(
               'username' => $this->input->post('username', TRUE) ,
               'password' => $this->input->post('password', TRUE),
                    );
        $result=$this->User_model->authenticateUser($data);
        if ($result != NULL ){
            /*    Settare gli attributi di sessione     */    
            /* $res_sess = array(
                                            'logged_in' => TRUE
                            'role' => $result->role;
                           );
            $this->session->set_userdata($re_sess); */        
            

                   redirect('protected','refresh');
        }
        else{
            $this->index();
        }
        
    }
    
}
?>


This works well until i leave comments on this parts
Code:
/* $res_sess = array(
                                            'logged_in' => TRUE
                            'role' => $result->role;
                           );
            $this->session->set_userdata($re_sess); */


If i delete comments, i have a blank screen while attempting to

http://mysite.com/index.php/login

(The strange thing is that i'm in index() while i call login without parameters...
and the code is in authenticate function..)

Any help?

Thanks in advance...

Stefano Marino

#2
[eluser]gtech[/eluser]
Code:
$res_sess = array('logged_in' => TRUE,
                  'role' => $result->role);

Hello,

there should be a comma after the TRUE bit in the array and you should not need the semi colon after the $result->role bit.. those php errors may cause your blank screen. If you have syntax errors in your code this may stop the controller from loading properly and hence why you see problems when accessing the index method.

#3
[eluser]jenie_net[/eluser]
Incredible...i'm so stupid!

Thanks a lot, and sorry!!

Stefano Marino


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.