Example #1
0
        /// <summary>
        /// 检测在线用户表
        /// </summary>
        /// <param name="U_LoginName">用户名</param>
        /// <param name="U_Password">密码</param>
        /// <param name="SessionID">用户sessionID</param>
        /// <param name="userkey">用户Key</param>
        private void checkOnline(string U_LoginName, string U_Password, string SessionID, string userkey)
        {
            if (FrameWorkOnline.Instance().OnlineCheck(U_LoginName))
            {
                HttpContext.Current.Session["CheckCode"] = Common.RndNum(4);
                //OnlineUser<int> ou =  FrameWorkPermission.UserOnlineList.GetValue(U_LoginName);
                OnlineUser <string> ou  = FrameWorkOnline.Instance().GetOnlineMember(U_LoginName);
                MessageBox          MBx = new MessageBox();
                MBx.M_Type     = 2;
                MBx.M_Title    = "重复登陆!";
                MBx.M_IconType = Icon_Type.Alert;

                MBx.M_Body = string.Format("您的用户名({0})已经于({1}),从({2})IP登陆在本系统.在线时间:{3}分.", U_LoginName, ou.U_StartTime, ou.U_LastIP, (ou.U_OnlineSeconds / 60).ToString("N2"));
                MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "default.aspx", "", UrlType.Href, true));
                MBx.M_ButtonList.Add(new sys_NavigationUrl("强制登陆", string.Format("Login.aspx?CMD=OutOnline&OPCode={0}&U_LoginName={1}&U_Password={2}&SessionID={3}", HttpContext.Current.Session["CheckCode"].ToString(), U_LoginName, U_Password, U_LoginName), "", UrlType.Href, false));
                FrameWorkLogin.MoveErrorLoginUser(userkey);
                EventMessage.MessageBox(MBx);
            }
            else
            {
                FrameWorkOnline.Instance().InsertOnlineUser(U_LoginName);
                //OnlineUser<int> us = new OnlineUser<int>();
                //us.U_Guid = UserID;
                //us.U_Name = U_LoginName;
                //us.U_Type = true;
                //us.U_LastUrl = Common.GetScriptUrl;
                //FrameWorkPermission.UserOnlineList.InsertUser(us.U_Guid, us);
            }
        }
Example #2
0
 /// <summary>
 /// 用户退出
 /// </summary>
 public static void UserOut()
 {
     //FrameWorkPermission.UserOnlineList.Remove(Common.Get_UserID);
     //写退出日志
     EventMessage.EventWriteDB(2, "用户退出", Common.Get_UserID);
     //退出操作
     FrameWorkOnline.Instance().OnlineRemove(UserData.GetUserDate.U_LoginName, Common.GetSessionID);
     UserData.Move_UserPermissionCache(Common.Get_UserID);
     UserData.MoveUserCache(Common.Get_UserID);
     HttpContext.Current.Response.Cookies["MenuStyle"].Expires = DateTime.Now.AddDays(-30);
     HttpContext.Current.Response.Cookies["PageSize"].Expires  = DateTime.Now.AddDays(-30);
     HttpContext.Current.Response.Cookies["TableSink"].Expires = DateTime.Now.AddDays(-30);
     System.Web.Security.FormsAuthentication.SignOut();
 }
Example #3
0
        /// <summary>
        /// 处理认证成功事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void app_Auth(object sender, EventArgs e)
        {
            //CheckDisableIp();
            //进行在线更新检测
            if (checkUpdateData == null)
            {
                checkUpdateData = new CheckUpdate();
                //检测更新版本
                if (checkUpdateData.CheckOk == false && FrameSystemInfo.GetSystemInfoTable.S_SystemConfigData.C_CheckUpdate)
                {
                    //checkUpdateData.SendDataWeb();
                    DelegateCheckUpdate dc = new DelegateCheckUpdate(checkUpdateData.SendDataWeb);
                    dc.Invoke();
                }
            }
            //判断是否在manager目录里
            if (Common.GetCharInStringCount("/manager/", Common.GetScriptUrl.ToLower()) > 0)
            {
                //判断文件名是否为aspx
                if (Common.GetScriptNameExt.ToLower() == "aspx")
                {
                    //判断
                    if (Common.Get_UserID != 0)
                    {
                        //判断在线用户

                        //if (UserOnlineList.CheckMemberOnline(UserData.GetUserDate.U_LoginName.ToLower(), Common.Get_UserID))
                        //{
                        //    UserOnlineList.Access(Common.Get_UserID, Common.GetScriptUrl);
                        //}
                        //string abc = Common.GetSessionID;

                        if (FrameWorkOnline.Instance().CheckUserInOnline(UserData.GetUserDate.U_LoginName, Common.GetSessionID))
                        {
                            FrameWorkOnline.Instance().OnlineAccess(UserData.GetUserDate.U_LoginName);
                        }
                        else
                        {
                            if (Common.OnlineMinute != 0)
                            {
                                FrameWorkLogin.UserOut();
                                MessageBox MBx = new MessageBox();
                                MBx.M_Type     = 2;
                                MBx.M_Title    = "没有登陆!";
                                MBx.M_IconType = Icon_Type.Error;
                                MBx.M_Body     = "您与系统的连接已经超时,请重新登陆!";
                                MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "~/Manager/default.aspx", "", UrlType.Href, true));
                                EventMessage.MessageBox(MBx);
                            }
                        }

                        //检测权限
                        if (!Check_Permission)
                        {
                            MessageBox MBx = new MessageBox();
                            MBx.M_Type     = 2;
                            MBx.M_Title    = "权限出错";
                            MBx.M_IconType = Icon_Type.Error;
                            MBx.M_Body     = "无权访问当前页面!";
                            MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "history.back();", "", UrlType.JavaScript, true));
                            EventMessage.MessageBox(MBx);
                        }

                        //更新当前用户最后访问记录
                        if (Common.GetDBType == "Oracle")
                        {
                            BusinessFacade.Update_Table_Fileds("sys_User", string.Format("U_LastIP='{0}',U_LastDateTime=to_date('{1}','yyyy-mm-dd HH24:MI:SS')", Common.GetIPAddress(), DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss")), string.Format("UserID={0}", Common.Get_UserID));
                        }
                        else
                        {
                            BusinessFacade.Update_Table_Fileds("sys_User", string.Format("U_LastIP='{0}',U_LastDateTime='{1}'", Common.GetIPAddress(), DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss")), string.Format("UserID={0}", Common.Get_UserID));
                        }

                        //写访问日志
                        if (FrameSystemInfo.GetSystemInfoTable.S_SystemConfigData.C_RequestLog)
                        {
                            EventMessage.EventWriteDB(3, "访问网页");
                        }
                    }
                }
            }
        }