コード例 #1
0
        // 添加一次失败验证次数
        public static void failOne(string f, string ip)
        {
            mban.WaitOne();
            Hashtable iplist = IPDATA.getAllData(f);
            Object    o      = iplist[ip];

            if (o != null)
            {
                IPDATA   od  = (IPDATA)o;
                DateTime ndt = DateTime.Now.Date;
                if (!od.dt.Equals(ndt))
                {
                    od.failTimes = 0;
                }
                ++od.failTimes;
                od.dt = ndt;
            }
            else
            {
                o = iplist[ip] = new IPDATA();
                IPDATA od = (IPDATA)o;
                od.ip = ip;
                ++od.failTimes;
                od.dt = DateTime.Now.Date;
            }
            IPDATA.saveAllData(f, iplist);
            mban.ReleaseMutex();
        }
コード例 #2
0
        // 解锁
        public static void clear(string f, string ip)
        {
            mban.WaitOne();
            Hashtable iplist = IPDATA.getAllData(f);
            Object    o      = iplist[ip];

            if (o != null)
            {
                IPDATA od = (IPDATA)o;
                od.failTimes = 0;
                od.dt        = DateTime.Now.Date;
            }
            IPDATA.saveAllData(f, iplist);
            mban.ReleaseMutex();
        }