Esempio n. 1
0
        public static string Ban(TcpClient clientSocket, string data)
        {
            string ServerResponse;
            string Username;
            string token;
            Token  Token;

            if (Request.Contains("Username", data))
            {
                Username = Request.Get("Username", data);

                if (Request.Contains("Token", data))
                {
                    token = Request.Get("Token", data);

                    Token = new Tokens.Token(((IPEndPoint)clientSocket.Client.RemoteEndPoint).Address.ToString(), Tokens.Tokens.GetTokenByToken(token).ID, Tokens.Tokens.GetTokenByToken(token).Username, token);

                    Connect connect = new Connect();

                    if (connect.BanUser(Username, Token))
                    {
                        ServerResponse = "Banned User";
                    }
                    else
                    {
                        ServerResponse = "Failed to Ban User";
                    }

                    connect.Close();
                }
                else
                {
                    ServerResponse = "Token not Provided";
                }
            }
            else
            {
                ServerResponse = "Username not Provided";
            }
            return(ServerResponse);
        }