public static Online UpdateInfo(int uid = -1, string passwd = "") { var cfg = GeneralConfigInfo.Current; var passwordkey = cfg.Passwordkey; string iP = WebHelper.UserHost; int userid = GetCookie("userid").ToInt(uid); string pass = passwd.IsNullOrEmpty() ? GetCookiePassword(passwordkey) : GetCookiePassword(passwd, passwordkey); if (pass.Length == 0 || !Utils.IsBase64String(pass)) { userid = -1; } var online = Current; if (userid > 0) { // 根据用户ID和密码来验证在线信息 //var online = Online.GetOnlineUser(userid, pass); if (!DNTRequest.GetPageName().EndsWith("ajax.ashx") && cfg.Statstatus) { Stat.IncCount(false, online != null); } if (online != null) { if (online.UserID != userid) { var user = User.Check(userid, pass, false); if (user != null) { online.SetUser(user); } else { XTrace.WriteLine("用户ID={0} Pass={1}验证失败 当前登录{2}", userid, pass, online.UserID); online.SetGuest(); } } // 如果IP变了,更换一下 online.IP = iP; online.Save(); return(online); } else { CheckIp(iP); // 如果找不到在线信息,则准备登录 var user = User.Check(userid, pass, false); if (user != null) { return(Online.CreateUser(userid)); } XTrace.WriteLine("用户ID={0} Pass={1}验证失败", userid, pass); return(CreateGuestUser()); } } else { //var online = Online.FindByUserIDAndIP(-1, iP); if (!DNTRequest.GetPageName().EndsWith("ajax.ashx") && cfg.Statstatus) { Stat.IncCount(true, online != null); } if (online == null) { return(CreateGuestUser()); } return(online); } }