02.02.2014, 20:41
Hey, guys.
So recently I have been re-scripting how my ban system works... This isn't really a problem but during the testing stages I came across quite a big gap that I'm so glad I didn't completely overlook it before bringing it out.
Right now I had a checkup when a player connected with their master account name, to see if that master account was in the banned database, if so to notify them that this account had been banned and then kicking them from the server.
What I hadn't realized was... I keep logs of the IP's of every member who is banned inside the database, but I wasn't using that row to check if they may have came back with a new master account but the same IP. Because I was only checking for the master account, they could easily slip back in with the same IP as long as the master account was different.
So my simple question is... Instead of doing this and ONLY checking for the master account
If it possible to use an OR function with MySQL? I'm aware that there is an AND function, but then that would check if the master account and Ip matched the same ones in the database, meaning it would let them in if one or the other was different. So I was wondering if an OR function was available to say that... If one or the other matched, kick them from the server.
So it would then be more like
Then simply check to see if any rows return with a matching IP OR MasterAccount, and deal with that player accordingly.
Thank you guys. It's really hard to explain something you're un-sure about but I'm not one of the people who just EXPECT an answer. I at least give you guys my view of it to see if it would work and if it wouldn't... or even if there is a better way in doing it.
So recently I have been re-scripting how my ban system works... This isn't really a problem but during the testing stages I came across quite a big gap that I'm so glad I didn't completely overlook it before bringing it out.
Right now I had a checkup when a player connected with their master account name, to see if that master account was in the banned database, if so to notify them that this account had been banned and then kicking them from the server.
What I hadn't realized was... I keep logs of the IP's of every member who is banned inside the database, but I wasn't using that row to check if they may have came back with a new master account but the same IP. Because I was only checking for the master account, they could easily slip back in with the same IP as long as the master account was different.
So my simple question is... Instead of doing this and ONLY checking for the master account
pawn Код:
public OnPlayerConnect(playerid)
{
new query[128];
format(query, sizeof(query), "SELECT * FROM `BannedPlayers` WHERE MasterAccount='%s'", PlayerName(playerid));
mysql_function_query(dbHandle, query, true, "CheckBannedList", "i", playerid);
So it would then be more like
pawn Код:
public OnPlayerConnect(playerid)
{
new query[128];
new plrIP[16];
GetPlayerIp(playerid, plrIP, sizeof(plrIP));
format(query, sizeof(query), "SELECT * FROM `BannedPlayers` WHERE MasterAccount='%s' OR IP='%s'", PlayerName(playerid), plrIP;
mysql_function_query(dbHandle, query, true, "CheckBannedList", "i", playerid);
Thank you guys. It's really hard to explain something you're un-sure about but I'm not one of the people who just EXPECT an answer. I at least give you guys my view of it to see if it would work and if it wouldn't... or even if there is a better way in doing it.