• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Unable to load session

#1
Exclamation 
(01-16-2019, 10:04 AM)jlp Wrote: CodeIgniter 3.1.10 was released today, with some changes and some bug fixes.

Changes: added ‘ssl_verify’ support to the ‘pdo/mysql’ Database driver; renamed Inflector Helper function 'is_countable()' to 'word_is_countable()' due to the former colliding with one introduced in PHP 7.3.0

Bug fixes: Database library, caching, forge, & mysqli driver; form validation, session & XML-RPC libraries; captcha helper

This is recommended for all users of version 3. Download v3.1.10 now, and we encourage you to read the changelog, and to check the directions for upgrading from a previous version.

hii everybody, im sorry if my english language is bad, i have a problem on CI 3 this the error code Unable to locate the specified class: Session.php , I think I've loaded the session library on autoload but why the error still appear ? please help me


Code:
//this is autoload in config/autoload.php
$autoload['libraries'] = array('database','session');


Code:
// This is my Auth controller
class Auth extends CI_Controller
{

    public function __construct()
    {
        parent::__construct();
        $this->load->model('Auth_model');
        // $this->load->library('session');
    }
    public function login()
    {
        $username = $this->input->post('username');
        $password = $this->input->post('password');

        $data['user']     =  $this->Auth_model->getDataUser($username);
        $data['row']     = $this->Auth_model->getRowUser($username);
        $passhash         = $data['user']['password'];
        $status         = $data['user']['status'];
        $level             = $data['user']['level'];

            if ( $data['row'] == 1 ){ //CHECK JUMLAH USER
                if ( password_verify($password, $passhash ) ) { //CHECK VALIDASI PASSWORD
                    if ( $status == 'on' ){ // CHECK STATUS USER
                        if ( $level == 'customer' ){ // JIKA USER CUSTOMER
                            $data_session = array(
                                'username' => $data['user']['username'],
                                'user_id' => $data['user']['user_id'],
                                'status_login' => "yes"
                            );
                            $this->session->set_uerdata($data_session);
                            var_dump($this->session->userdata());
                            redirect('Home');
                        }elseif( $level == 'admin' ){ // JIKA USER ADMIN
                            $data_session = array(
                                'username' => $data['user']['username'],
                                'user_id' => $data['user']['user_id'],
                                'id_barbershop' => $data['user']['id_barbershop'],
                                'status_login' => "yes"
                            );
                            $this->session->set_uerdata($data_session);
                            redirect('Admin');
                        }elseif ( $level == 'adminDev' ){ // JIKA USER ADMINDEV
                            $data_session = array(
                                'username' => $data['user']['username'],
                                'user_id' => $data['user']['user_id'],
                                'status_login' => "yes"
                            );
                            $this->session->set_uerdata($data_session);
                            redirect('AdminDev');
                        }
                    }elseif ( $status == 'off' ){ // JIKA USER OFF
                        echo "yahh aku OFF nih";
                    }
                }else{ // JIKA PASSWORD USER SALAH
                    echo "SALAH";
                }
            }else{ // JIKA USER TIDAK ADA
                echo "NO";
            }
    }
    
    public function logout(){
        $this->session->sess_destroy();
        redirect('Home/login');
    }

}


Code:
//this is my Auth_model
class Auth_model extends CI_Controller
{
    public function getDataUser()
    {
        $username = $this->input->post('username' , true);
        $query =  $this->db->get_where('users' , ['username' => $username ])->row_array();
        return $query;
    }

    public function getRowUser()
    {
        $username = $this->input->post('username' , true);
        // $query = $this->db->query("SELECT * FROM users ");
        return $this->db->where(['username' => $username ])->from("users")->count_all_results();;
    }
}
Reply

#2
look out for model extends.
Auth_model extends CI_Controller ??
-> Auth_model extends CI_Model.
I have headache over night.. 
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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