private static bool CheckPlayerStatus(Candidate c) { List<string>[] playerInfo; string ipAddress = ((IPEndPoint)c.socket.RemoteEndPoint).Address.ToString(); if (!Database.Instance.SelectPlayerData(out playerInfo, c.loginName)) { AppendLog("Couldn't connect with database for: " + ipAddress + ". Rejecting..."); SendClient_AlertMsg(c.socket, "Unexpected loss of connection, try again in a minute!", true); KillClientSocket(c); return false; } if (playerInfo[0].Count == 0) { AppendLog("->" + c.loginName + "<-(" + ipAddress + ") doesn't exist in the database. Rejecting..."); SendClient_AlertMsg(c.socket, "Sorry, but it seems that you've entered an incorrect login or password. Please try again!", true); KillClientSocket(c); return false; } PlayerDBInfo pInfo = new PlayerDBInfo(playerInfo[0][0], playerInfo[1][0], playerInfo[2][0], playerInfo[3][0]); if (!CheckPassword(pInfo, c.password)) { AppendLog("Wrong password for: " + c.loginName + "/" + ipAddress + ". Rejecting..."); SendClient_AlertMsg(c.socket, "Sorry, you've entered incorrect login or password. Please try again!", true); KillClientSocket(c); return false; } if (!CheckValidating(pInfo)) { AppendLog("Account is not verified for: " + c.loginName + "/" + ipAddress + ". Rejecting..."); SendClient_AlertMsg(c.socket, "Please validate your account, by confirming your email address!", true); KillClientSocket(c); return false; } //Load Player, to synchronize his status - gold silver admin. PreloadPlayer(c, pInfo); if (!CheckAdmin(pInfo, c)) { SendClient_AlertMsg(c.socket, "Sorry, but the server is only available to staff members at the moment.", true); AppendLog(c.loginName + "/" + ipAddress + " isn't an Admin. Rejecting..."); KillClientSocket(c); return false; } if (!CheckSubscription(pInfo, c)) { SendClient_AlertMsg(c.socket, "Sorry, but the server is only available to Gold or Silver Shinobi at the moment.", true); AppendLog(c.loginName + "/" + ipAddress + " isn't a Donor" + "" + ". Rejecting..."); KillClientSocket(c); return false; } //No more checks, it's seems player can join the server. AccountsManager file = new AccountsManager(_form); file.SavePlayer(c.loginName, ref c.player); file.SavePlayerBank(c.loginName, ref c.playerBank); if (!SendClient_ServerDetails(c)) { SendClient_AlertMsg(c.socket, "Server is down, try again in a minute!", true); AppendLog(c.loginName + "/" + ipAddress + " rejected -> no available servers"); KillClientSocket(c); } return true; }