/// <summary> /// 从cookie中获取转向页 /// </summary> /// <returns>string</returns> public static string GetReUrl() { if (HTTPRequest.GetString("reurl").Trim() != "") { UsersUtils.WriteCookie("reurl", HTTPRequest.GetString("reurl").Trim()); return(HTTPRequest.GetString("reurl").Trim()); } else { if (UsersUtils.GetCookie("reurl") == "") { return("default.aspx"); } else { return(UsersUtils.GetCookie("reurl")); } } }
/// <summary> /// 用户在线信息维护。判断当前用户的身份(会员还是游客),是否在在线列表中存在,如果存在则更新会员的当前动,不存在则建立. /// </summary> /// <param name="passwordkey">系统passwordkey</param> /// <param name="timeout">在线超时时间</param> /// <param name="passwd">用户密码</param> public static OnlineUserInfo UpdateInfo(string passwordkey, int timeout, int uid, string passwd) { lock (SynObject) { OnlineUserInfo onlineuser = new OnlineUserInfo(); string ip = HTTPRequest.GetIP(); int userid = Utils.StrToInt(UsersUtils.GetCookie("UserID"), uid); string password = (passwd == string.Empty ? UsersUtils.GetCookiePassword(passwordkey) : UsersUtils.GetCookiePassword(passwd, passwordkey)); if (password.Length == 0) { userid = -1; } // 如果密码非Base64编码字符串则怀疑被非法篡改, 直接置身份为游客 else if (!Utils.IsBase64String(password)) { userid = -1; } if (userid != -1) { onlineuser = GetOnlineUserInfo(userid); if (onlineuser != null) { if (onlineuser.oIP != ip) { UpdateIP(onlineuser.olID, ip); onlineuser.oIP = ip; return(onlineuser); } } else { // 判断密码是否正确 userid = BLL.tbUserInfo.CheckPassword(userid, password, false); if (userid != -1) { DeleteRowsByIP(ip); return(CreateUser(userid, timeout)); } else { // 如密码错误则在在线表中创建游客 onlineuser = GetOnlineUserByIP(-1, ip); if (onlineuser == null) { return(CreateGuestUser(timeout)); } } } } else { onlineuser = GetOnlineUserByIP(-1, ip); if (onlineuser == null) { return(CreateGuestUser(timeout)); } } //UpdateLastTime(onlineuser.Olid); onlineuser.oLastTime = DateTime.Now; // DateTime.Parse(Utils.GetDateTime()); return(onlineuser); } }