[Release] Banning IPs

Skilled Illusionist
Joined
Feb 19, 2008
Messages
320
Reaction score
0
Thought id release it here aswell as elitepvpers

Here you may stop unwanted ips from getting into your server (LOTF) since the majority are using it,
Yes you may not need it but eh i might aswell release it XD

In your release/debug folder make a txt doc where the ips will be stored

Now in General.cs find public static
Code:
System.IO.StreamWriter sw = new System.IO.StreamWriter(Application.StartupPath + @"ServerLog.txt", true);
Replace with
Code:
public static string BannedIP = System.IO.File.ReadAllText(Application.StartupPath + @"IPTEXTFILLYOUMADE.txt");
System.IO.StreamWriter(Application.StartupPath + @"ServerLog.txt", true);
Change IPTEXTFILLYOUMADE.txt to the txt file you made in your debug/release
Now in General.cs again find the AuthPacket void
Search for
Code:
if (Auth != 0)
                        {
General.WriteLin(blahblah)

Replace with
Code:
 if (Auth != 0)
                        {
                            if (BannedIP.Contains(Ip))
                            {
                                Sock.Disconnect(true);
                            }
                            General.WriteLine("Successful login for Account " + ":" ThisAcc + "-IP-" + Ip);
 
Back