예제 #1
0
 /**
  * 检验是否非法登陆操作,再检查管理员权限
  * @param power 需要的权限
  * @return [boolean] 
  */
 public function checkPower($controller, $power)
 {
     if ($this->log_helper->checkLogin($controller)) {
         $powers = $this->session->userdata('powers');
         if (strpos($powers, '超级管理员') !== false || strpos($powers, $power) !== false) {
             return true;
         } else {
             echo '<script>alert("没有权限!");</script>';
             //重定向浏览器
             header('Location: http://' . $_SERVER['HTTP_HOST'] . my_base_url() . '/admin/index');
         }
     }
     return false;
 }
예제 #2
0
 /**
  * 
  * 函数功能说明 登陆<br>
  * 作者名字 panda<br>
  * 创建日期 2015-7-21<br>
  * 修改日期 2015-7-23<br>
  * 
  * @参数: String wrokID 工号 <br>
  *      String password 密码 <br>
  * @return i. 判断工号存在性,假如不存在,bool为-1 <br>
  *         ii. 判断工号、密码是否匹配,是进行下一步,否则bool为0 <br>
  *         iii. 判断密码是否为身份证后六位,如果是,bool为2,否则bool为1 <br>
  */
 public function login()
 {
     $id = $this->input->post("id", true);
     $psw = $this->input->post("psw", true);
     $is_login = $this->input->post("is_login", true);
     $flag = false;
     $bool = 0;
     $bool = $this->employee_action->login($id, $psw);
     if (0 < $bool) {
         $flag = true;
     }
     if ($flag) {
         // 登陆成功后的动作
         $employee = $this->employee_action->getEmployeeByWorkID($id);
         $employee_logined = array('employee_workId' => $employee->workId, 'employee_name' => $employee->name, 'employee_job' => $employee->job, 'employee_authority' => $employee->authority, 'employee_seviral' => md5(rand(10000, 999999)), 'employee_token' => md5(rand(10000, 999999)));
         //如果用户选择记住登陆
         //cookie
         if ($is_login) {
             $this->input->set_cookie("employee_logined", $this->json_helper->encode($employee_logined), 60 * 60 * 24 * 7);
         } else {
             $this->input->set_cookie("employee_logined", $this->json_helper->encode($employee_logined), 60 * 60 * 24);
         }
         //session
         $this->config->set_item('sess_expiration', 60 * 60 * 24);
         $this->session->set_userdata($employee_logined);
         //记录日志
         $this->log_helper->writeLog($employee->name, 'login');
         if (2 == $bool) {
             $data['id'] = $employee->workId;
             $this->load->view('modify_password', $data);
             return;
         }
         //如果登陆成功,则跳转至首页url  panda修改于2015-7-23 23::02:50
         echo '<script>window.location.href="http://' . my_base_url() . '"</script>';
         $this->load->view('footer');
     } else {
         echo '<script>alert("' . (-1 == $bool ? '帐号' : '密码') . '错误");</script>';
         $this->load->view('login');
     }
 }
예제 #3
0
                                <input type="text" class="form-control" placeholder="请输入您的工号" name="id" />
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-12">
                                <input type="password" class="form-control" placeholder="请输入您的密码" name="psw" />
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-12">
                                <button class="btn btn-primary btn-block" type="submit"><i class="glyphicon glyphicon-ok-sign"></i>登录</button>
                            </div>  
                        </div>
                        <div class="login-subtitle">
                            <a href="http://<?php 
echo my_base_url();
?>
/employee_login/forget_password">忘记密码?</a>
                        </div>
                    </form>
                </div>
                <div class="login-footer">
                    <div class="pull-left">
                        &copy; 2015 SXOA
                    </div>
                </div>
            </div>
            
        </div>
        
        <script type="text/javascript" src="<?php