CI - Pengaksesan Sebuah Halaman
Pengaksesan sebuah halaman
Part 1
function __construct(){
parent::__construct();
if(!isset($this->session->userdata['username'])){
$this->session->set_flashdata('pesan','<div class="alert alert-danger alert-dismissible fade show" role="alert">
Anda Belum Login !
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>');
redirect("administrator/auth");
}
}
part 2
public function __construct(){
parent :: __construct();
if($this->session->userdata('role_id') !=2 ){
$this->session->set_flashdata('pesan','<div class="alert alert-warning alert-dismissible fade show" role="alert">
Anda Belum Login
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>');
redirect('auth/login');
}
}
No comments