zoukankan      html  css  js  c++  java
  • 禁止同一用户 多次登录

    void startupPost()
    {
        int         counter;
        int         maxUserSessions = 1;
        int         maxAdminSessions = 4;
        int         num = 0;
        int         maxSessions = Info::licensedUsersTotal();
        xSession    session;
        UserInfo    userInfo;
        UserId      currentUserId;
        UserGroupList   UserGroupList;
        FormRun         formRun;
        ;
        currentUserId = curuserid();
        if (currentUserId == 'Admin')
            return;
        for(counter = 1; counter < maxSessions;counter++ )
        {
            session = new xSession(counter, true);
            if(session && session.userId())
            {
                select firstOnly userInfo
                    where userInfo.id == session.userId();
                if (userInfo && (currentUserId == session.userId()))
                    num++ ;
            }
        }

        while select userGroupList
            where userGroupList.userId == currentUserId
            && userGroupList.groupId == 'Admin'
            maxUserSessions = maxAdminSessions;

        if (num > maxUserSessions)
            {
            box::stop(strfmt("The same user id can't log in more than %1.", maxUserSessions));
            infolog.shutDown(true);
            }

        if(curuserid() == "MF" || (curuserid() == "AAL"))
        {
            if(!WinAPI::isControlButtonDown() &&
            DEV_AxAssistFunc::checkActiveXRegistered())
            {
                formRun = new MenuFunction(menuItemDisplayStr(DEV_AxAssistForm),MenuItemType::Display).create();
                if(formRun)
                {
                    formRun.run();
                    formRun.detach();
                }
            }
        }

        if(!WinAPI::isShiftButtonDown())
        {
            // check for user ID
            if(curUserId()=="MF") // <- change to your loginname
            {
                // actually run tabax
                TreeNode::findNode(@'\\Forms\\'+formStr(Tabax)).AOTrun();
            }
        }

    }

  • 相关阅读:
    HTML DOM item() 方法
    php输出年份
    CSS中如何选择ul下li的奇数、偶数行
    对象的继承
    this指向
    如何安装Firebug
    JSON数据格式
    PHP: configure: error: mysql configure failed. Please check config.log for more information.
    linux下挂载iso镜像文件(转)
    Linux 下mysql修改数据库存放目录方法和可能遇到的问题
  • 原文地址:https://www.cnblogs.com/perock/p/2375276.html
Copyright © 2011-2022 走看看