Postingan lainnya
Session CI tidak jalan muncul tulisan "Unable to locate the specified class: Session.php"
Controller c_login:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class c_login extends CI_Controller {
public function index(){
$this->load->view('v_login');
}
public function aksiLogin(){
$user=$this->input->post('user');
$password=$this->input->post('password');
$data=array(
'username'=>$user,
'password'=>$password
);
$nilai=$this->m_penjualan->logindata('logindata',$data);
if(count($nilai)>0){
$datasession=array(
'nama'=>$user,
'status'=>"login"
);
$this->session->set_userdata($datasession);
redirect('c_admin/index');
}else{
echo "Password dan username anda salah!!!";
}
}
}
Model m_penjualan:
public function logindata($table,$where){
return $this->db->get_where($table,$where);
}
controller c_admin:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class c_admin extends CI_Controller {
public function __construct()
{
parent::__construct();
if($this->session->userdata('status') != "login"){
redirect('c_login');
}
}
public function index(){
$this->load->view('v_admin');
}
}
0
5 Jawaban:
Tambahkan perubahan ke konfigurasi library di file application/config/autoload.php
$autoload['libraries'] = array('database', 'session');
Jika masih mendapatkan error yang sama, copy System/libraries/Session/Session.php ke System/libraries/
1
Tanggapan
thanks gan yang ini work disaya copy System/libraries/Session/Session.php ke System/libraries/
saya di autoload sudah pake session gan, tapi masih error
0
apa isi c_login di awal seperti ini?
function __construct(){
parent::__construct();
$this->load->library('session');
}
0
kalo session di autoload saya hilangkan malah muncul form loginnya
0