Part of the EllisLab Network
   
 
Blank Screen using sessions…
Posted: 18 May 2008 07:56 PM   [ Ignore ]  
Summer Student
Avatar
Total Posts:  7
Joined  01-27-2008

Hi all!

I’ve got a controller Login.php

<?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

/* $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

 Signature 

Officianally Ignited

Profile
 
 
Posted: 18 May 2008 08:02 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  865
Joined  09-25-2007
$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.

Profile
 
 
Posted: 18 May 2008 09:08 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  7
Joined  01-27-2008

Incredible…i’m so stupid!

Thanks a lot, and sorry!!

Stefano Marino

 Signature 

Officianally Ignited

Profile