示例#1
0
文件: Home.php 项目: saj696/dcms_new
 public function login()
 {
     $user = User_helper::get_user();
     if ($user) {
         $this->dashboard_page();
     } else {
         if ($this->input->post()) {
             if (User_helper::login($this->input->post("username"), $this->input->post("password"))) {
                 $user = User_helper::get_user();
                 $user_info['user_id'] = $user->id;
                 $user_info['login_time'] = time();
                 $user_info['ip_address'] = $this->input->ip_address();
                 $user_info['request_headers'] = json_encode($this->input->request_headers());
                 Query_helper::add($this->config->item('table_user_login_history'), $user_info);
                 $this->dashboard_page($this->lang->line("MSG_LOGIN_SUCCESS"));
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_USERNAME_PASSWORD_INVALID");
                 $this->jsonReturn($ajax);
             }
         } else {
             $this->login_page();
             //login page view
         }
     }
 }
示例#2
0
 public function login($module_id = 0)
 {
     $user = User_helper::get_user();
     if ($user) {
         $this->dashboard_page($module_id);
     } else {
         if ($this->input->post()) {
             if (User_helper::login($this->input->post("username"), $this->input->post("password"))) {
                 $this->dashboard_page($module_id, $this->lang->line("MSG_LOGIN_SUCCESS"));
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_USERNAME_PASSWORD_INVALID");
                 $this->jsonReturn($ajax);
             }
         } else {
             $this->login_page();
         }
     }
 }