Welcome Guest, Not a member yet? Register   Sign In
Can i check userlogin in construct ?
#1

(This post was last modified: 11-27-2014, 03:47 AM by bobykurniawan.)

PHP Code:
class Admin extends CI_Controller {
function 
__construct()
{
 
   parent::__construct();
 
      $aut $this->donaturlib->is_admin();
 
   if(!$aut)
 
   {
$msg="Mohon Maaf anda tidak memiliki akses";
$this->session->set_flashdata('donatur',$msg);
redirect('welcome');
 
   }
 
   $this->link ='login/out';
$this->info ='Logout';
}
function 
index()
{
$data['link']=$this->link;
$data['info']=$this->info;
$data['include']= 'default';
$this->load->view('a_template/main.php',$data);    
}


Up there is my script, i'm trying to check the user login in function __construct. It's working fine, but is it 'in the right way'?
Reply


Messages In This Thread
Can i check userlogin in construct ? - by bobykurniawan - 11-27-2014, 03:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB