示例#1
0
 function index()
 {
     $user = $this->login_manager->get_user();
     if ($user !== FALSE) {
         // already logged in, redirect to welcome page
         redirect('admin/dashboard');
     }
     // Create a user to store the login validation
     $user = new adminuser();
     if ($this->input->post('username') !== FALSE) {
         // A login was attempted, load the user data
         $user->from_array($_POST, array('username', 'password'));
         // get the result of the login request
         $login_redirect = $this->login_manager->process_login($user);
         if ($login_redirect) {
             if ($login_redirect === TRUE) {
                 // if the result was simply TRUE, redirect to the welcome page.
                 redirect('admin/navi/index/11');
             } else {
                 // otherwise, redirect to the stored page that was last accessed.
                 $login_redirect = getrealuri($login_redirect);
                 redirect($login_redirect);
             }
         }
     }
     $data['base_url'] = base_url();
     $data['msg'] = $user->error->string;
     $this->load->view('admin/login/login', $data);
 }
示例#2
0
 function get_user()
 {
     if (is_null($this->logged_in_user)) {
         $id = $this->session->userdata('logged_in_id');
         if (is_numeric($id)) {
             $u = new adminuser();
             $u->get_by_id($id);
             if ($u->exists()) {
                 $u->adminrole->get();
                 $this->logged_in_user = $u;
                 return $this->logged_in_user;
             }
         }
         return FALSE;
     } else {
         return $this->logged_in_user;
     }
 }
示例#3
0
 public function syncAdminUser()
 {
     $obj = new adminuser();
     $res = $obj->addRole();
     foreach ($res as $info) {
         $post['dosubmit'] = 1;
         $post['info'] = $info;
         $a = curl_post(ADDROLE, $post);
     }
     $res = $obj->addUser();
     foreach ($res as $info) {
         $post['dosubmit'] = 1;
         $post['info'] = $info;
         curl_post(ADDUSER, $post);
     }
 }
示例#4
0
 private function _get_user()
 {
     $id = $this->session->userdata('logged_in_id');
     if (is_numeric($id)) {
         $u = new adminuser();
         $u->get_by_id($id);
         if ($u->exists()) {
             $logged_in_user = $u;
             return $logged_in_user;
         }
     }
     return FALSE;
 }
示例#5
0
 function delete()
 {
     $this->checkRole(array(1));
     $id = $this->uri->segment(4);
     $adminuser = new adminuser($id);
     if (!$adminuser->exists()) {
         show_404();
     }
     $adminuser->delete();
     redirect($this->admin . 'adminusers/list_all/');
 }