Пример #1
0
        public bool CheckIp(string Ip)
        {
            Ip_ban ban = Database.SelectObject <Ip_ban>("Ip=LEFT('" + Database.Escape(Ip) + "', " + Database.SqlCommand_CharLength() + "(Ip))");

            Log.Info("Checking IP", Ip);

            if (ban != null)
            {
                if (ban.Expire == 1 || TCPManager.GetTimeStamp() < ban.Expire)
                {
                    Log.Info("CheckIp", "Banned " + Ip);
                    return(false);
                }
                else
                {
                    Log.Info("CheckIp", "Unbanning " + Ip);
                    Database.DeleteObject(ban);
                    Database.ForceSave();
                }
            }

            return(true);
        }