Пример #1
0
 public function modif()
 {
     $user_id = $_GET['user_id'];
     $user_id = $user_id ? $user_id : ADMINUSERID;
     $uinfo = mod_member::get_oneamdinbyuser_id($user_id);
     if (!$uinfo) {
         mod_login::message('对不起,无此用户');
     }
     if ($_POST) {
         $user_id = $_POST['user_id'];
         $truename = $_POST['truename'];
         $oldpassword = $_POST['oldpassword'];
         $npwd = $_POST['new_password'];
         $cnpwd = $_POST['pwd_confirm'];
         if ($oldpassword && md5($oldpassword) != $uinfo['password']) {
             mod_login::message('原始密码错误');
         }
         if ($oldpassword && $npwd != $cnpwd) {
             mod_login::message('两次不密码不一致');
         }
         $password = $oldpassword && $npwd ? $npwd : '';
         if ($password) {
             setcookie(AUTH_KEY . '_admin_auth', '', time() - 35920000, PATH_COOKIE);
         }
         mod_menu::save_user_nav($_POST['nav_list'][0], $user_id);
         mod_member::member_save($user_id, $password, $truename);
         mod_login::message('修改成功');
     } else {
         $nav_arr = mod_menu::get_user_nav($user_id);
         $menus = mod_menu::getmenulist();
         $action_link = array('href' => '?c=member&a=loginhistory', 'text' => '登录日志');
         pm_tpl::assign('action_link', $action_link);
         pm_tpl::assign('action', 'modif');
         pm_tpl::assign('nav_arr', $nav_arr);
         pm_tpl::assign('menus', $menus);
         pm_tpl::assign('ur_here', '更新个人信息');
         pm_tpl::assign('user', $uinfo);
         pm_tpl::display('member_info');
     }
 }