Welcome Guest, Not a member yet? Register   Sign In
session problem
#1

[eluser]kosaidpo[/eluser]
heyy guys

im tryin to make a simple login
this is my model where i fetch the session data
Code:
function m_login(){
    
    $this->db->select('username' ,'password' ,'status') ;
    $this->db->from('users') ;
    $usr_login=array('username' => $this->input->post('username'),
                     'password' => $this->input->post('password')
                    ) ;
    $this->db->where($usr_login);
    $Q=$this->db->get();
    if($Q->num_rows == 1){
    
    $session_data=array('session_user'=> $this->input->post('username'));
                              //'status'      =>  1 ,
                             //'is_on'       => true) ;
    $this->session->set_userdata($session_data) ;
    return true ;
    }
    else{
    return false ;
    }
    
}


and here my contoller where i verify the session data but it seems it doesnt work cus when i remove the cookie it still go through the if stmt am i makin some mistakes ?? anynone can correct me tnx



Code:
function login(){
    
    if(!$this->forum_model->m_login()){
        echo 'login/mdp est incorrect' ;
    }
    elseif($this->_check_session()){
        echo'hello<b>'. $this->session->userdata('session_user').'</b> you\'re logged    in' ;
        }
        else{
        echo 'no' ;
        }
}

function _check_session(){
    
       $sess_user=$this->session->userdata('session_user') ;
        if(empty($sess_user)){
        return false ;
        }
        else{
        return true ;
        }
}

between is there any function or tip to verify the hole array session cus affectin evry variable with the session item its kinda not so good i find

tnx in advance


Messages In This Thread
session problem - by El Forum - 03-27-2010, 06:04 AM
session problem - by El Forum - 03-27-2010, 06:43 AM
session problem - by El Forum - 03-27-2010, 07:02 AM
session problem - by El Forum - 03-27-2010, 07:18 AM
session problem - by El Forum - 03-27-2010, 10:15 AM
session problem - by El Forum - 03-27-2010, 10:42 AM
session problem - by El Forum - 03-27-2010, 12:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB