[TUTORIAL] Charles Character Name Hack Protection
Charles Character Name Hack Protection (%100)
Open
WZBackend-ASP.NET.slnSearch:
Code:
bool CheckCharName(string Gamertag)
Change:
Code:
bool CheckCharName(string Gamertag)
{
char[] AllowedChars = " 1234567890abcdefghijklmnopqrstuvwxyz".ToCharArray();
foreach (char c in Gamertag)
{
if (c.ToString().ToLower().IndexOfAny(AllowedChars) == -1)
{
return false;
}
if(Gamertag.Length >= 17) // long char name control
{
return false;
}
}
return true;
}
BUILD
Re: [TUTORIAL] Charles Character Name Hack Protection (%100)
or Sql Function
Code:
if(LEN(@in_Gamertag) > 16)BEGIN
select 'fuck' as ResultCode
RETURN
END
Re: [TUTORIAL] Charles Character Name Hack Protection
Why is the length check inside of the foreach? Should be like this instead:
Code:
bool CheckCharName(string Gamertag)
{
if (Gamertag.Length >= 17) // long char name control
{
return false;
}
char[] AllowedChars = "1234567890abcdefghijklmnopqrstuvwxyz".ToCharArray();
foreach(char c in Gamertag)
{
if (c.ToString().ToLower().IndexOfAny(AllowedChars) == -1)
{
return false;
}
}
return true;
}