/** * 强制修改密码执行页面 * @author 陈晓东 */ public function pwdcompelUpdateAction() { /** * 记录日志 */ $log = "强制修改密码执行页面\n\nServerIp:\n" . $this->request->getServer('SERVER_ADDR') . "\n\nGET:\n" . var_export($_GET, true) . "\n\nPOST:\n" . var_export($_POST, true); $this->oLogManager->push('log', $log); $id = trim($this->request->id); //用户ID $newpasswd = trim($this->request->newpasswd); //新密码 $confirm = trim($this->request->confirm); //确认密码 $group_id = $this->request->group_id; //用户组 $password = $this->manager->getOne($id, 'password'); if ($newpasswd != '') { if ($newpasswd != $confirm) { $response = array('errno' => 2); echo json_encode($response); return false; } if (strlen($newpasswd) < 6 || strlen($newpasswd) > 18) { $response = array('errno' => 3); echo json_encode($response); return false; } //密码强度检测 if (strlen($newpasswd) < 7) { $response = array('errno' => 5); echo json_encode($response); return false; } $bind['password'] = md5($newpasswd); $bind['reset_password'] = 0; } $res = $this->manager->update($id, $bind); if ($res) { $response = array('errno' => 0); $cookieManager = Base_String::encode($this->manager->id . ' ' . $this->manager->group_id . ' ' . $this->manager->name . ' ' . '0'); Base_Cookie::set('__Base_Manager', $cookieManager, 0); } else { $response = array('errno' => 9); } echo json_encode($response); return true; }
/** * 判断用户是否登录 * @return boolean */ public function isLogin() { if (null !== $this->isLogged) { return $this->isLogged; } else { $cookieManager = Base_Cookie::get($this->cookieName); @(list($id, $menu_group_id, $data_groups, $name, $reset_password) = explode(' ', Base_String::decode($cookieManager))); if ('' != $name && $id > 0) { $manager = array('name' => $name, 'id' => $id, 'reset_password' => $reset_password); $this->push($manager); $managerArr = $this->get($id); $this->menu_group_id = $managerArr['menu_group_id']; $this->data_groups = $managerArr['data_groups']; return $this->isLogged = true; } else { $this->logout(); } return $this->isLogged = false; } }
/** * 插入/新增一个管理员表单页面 * @author 陈晓东 */ public function addAction() { /** * 记录日志 */ $log = "插入/新增一个管理员表单页面\n\nServerIp:\n" . $this->request->getServer('SERVER_ADDR') . "\n\nGET:\n" . var_export($_GET, true) . "\n\nPOST:\n" . var_export($_POST, true); $this->oLogManager->push('log', $log); $PermissionCheck = $this->manager->checkMenuPermission("AddManager"); if ($PermissionCheck['return']) { $Widget_Group = new Widget_Group(); $menuGroup = $Widget_Group->getClass('1'); $dataGroup = $Widget_Group->getClass('2'); $pass = Base_String::random(8); include $this->tpl('manager_add'); } else { $home = $this->sign; include $this->tpl('403'); } }