A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

[Release - C#] LG Authentication Class

1.4k views · started by Chris ·
#1
[Release - C#] LG Authentication Class
Requires;
HTTPWrapper Class

using System;

class LGAuth
{
public enum UGLevel
{
NONE,
BRONZE,
SILVER,
GOLD
}

private HTTPWrapper Wrapper = new HTTPWrapper();

public Boolean Login(String Username, String Password)
{
return ((Wrapper.post("http://forum.logicalgamers.com/login.php?do=login", "vb_login_username=" + Username + "&vb_login_password_hint=Password&vb_login_password=" + Password + "&s=&securitytoken=guest&do=login&vb_login_md5password=&vb_login_md5password_utf=")).IndexOf("Thank you for logging in,") > -1) ? true : false;
}

public Boolean isUG(UGLevel Input)
{
if (Input <= getUGLevel())
{
return true;
}
return false;
}

private UGLevel getUGLevel()
{
String Return = Wrapper.get("http://forum.logicalgamers.com/");
if (Return.IndexOf("http://forum.logicalgamers.com/underground-gold/") > -1)
{
return UGLevel.GOLD;
}
else if (Return.IndexOf("http://forum.logicalgamers.com/underground-silver/") > -1)
{
return UGLevel.SILVER;
}
else if (Return.IndexOf("http://forum.logicalgamers.com/underground-bronze/") > -1)
{
return UGLevel.BRONZE;
}
return UGLevel.NONE;
}
}


Very simple, get's the job done.

Example usage;
            LGAuth LG = new LGAuth();
if (LG.Login("USERNAME", "PASSWORD") && LG.isUG(LGAuth.UGLevel.SILVER))
{
// setTimer to revalidate.
}
#2
Nice dude i wanna use this sometime:p nothing i make is good enough.
#3
wow C# is easier to use with http wrappers :D
#4
Dummy!! wrote:
wow C# is easier to use with http wrappers :D


It appears that way because users post more efficient C# wrappers than they do VB wrappers.
#5
Ill try to make a vb.net tut on to use httpwrappers but not like teh others :)
#6
Yay! i got it into vb.net thanks :D