if ($User_Model->isUserExist($login, $uid)) { emDirect("./user.php?action=edit&uid={$uid}&error_exist=1"); } if (strlen($password) > 0 && strlen($password) < 6) { emDirect("./user.php?action=edit&uid={$uid}&error_pwd_len=1"); } if ($password != $password2) { emDirect("./user.php?action=edit&uid={$uid}&error_pwd2=1"); } $userData = array('username' => $login, 'nickname' => $nickname, 'email' => $email, 'description' => $description, 'role' => $role, 'ischeck' => $ischeck); if (!empty($password)) { $PHPASS = new PasswordHash(8, true); $password = $PHPASS->HashPassword($password); $userData['password'] = $password; } $User_Model->updateUser($userData, $uid); $CACHE->updateCache('user'); emDirect('./user.php?active_update=1'); } if ($action == 'del') { LoginAuth::checkToken(); $users = $User_Model->getUsers(); $uid = isset($_GET['uid']) ? intval($_GET['uid']) : ''; if (UID == $uid) { emDirect('./user.php'); } //创始人账户不能被删除 if ($uid == 1) { emDirect('./user.php?error_del_a=1'); } $User_Model->deleteUser($uid);
if ($email != '' && !checkMail($email)) { emDirect("./blogger.php?error_b=1"); } elseif (strlen($newpass) > 0 && strlen($newpass) < 6) { emDirect("./blogger.php?error_c=1"); } elseif (!empty($newpass) && $newpass != $repeatpass) { emDirect("./blogger.php?error_d=1"); } elseif ($User_Model->isUserExist($login, UID)) { emDirect("./blogger.php?error_e=1"); } elseif ($User_Model->isNicknameExist($nickname, UID)) { emDirect("./blogger.php?error_f=1"); } } if (!empty($newpass)) { $PHPASS = new PasswordHash(8, true); $newpass = $PHPASS->HashPassword($newpass); $User_Model->updateUser(array('password' => $newpass), UID); } if (!empty($login)) { $User_Model->updateUser(array('username' => $login), UID); } $photo_type = array('gif', 'jpg', 'jpeg', 'png'); $usericon = $photo; if ($_FILES['photo']['size'] > 0) { $file_info = uploadFile($_FILES['photo']['name'], $_FILES['photo']['error'], $_FILES['photo']['tmp_name'], $_FILES['photo']['size'], $photo_type, true); if (!empty($file_info['file_path'])) { $usericon = !empty($file_info['thum_file']) ? $file_info['thum_file'] : $file_info['file_path']; } } $User_Model->updateUser(array('nickname' => $nickname, 'email' => $email, 'photo' => $usericon, 'description' => $description), UID); $CACHE->updateCache('user'); emDirect("./blogger.php?active_edit=1");