Page 1 of 1
Account block ip
Posted: Thu Jul 30, 2009 8:16 am
by streamsss
It is possible to realise the account block on IP?
To add new column Allow_IP, to bring pair of changes in a login, etc.
Very useful thing for protection gm an account.
sorry for my bad english.
Re: Account block ip
Posted: Thu Jul 30, 2009 9:46 am
by streamsss
example
logincontroller.java:
Code: Select all
con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT password, accessLevel, lastServer, AllowIPs FROM accounts WHERE login=?"); statement.setString(1, user); ResultSet rset = statement.executeQuery(); if (rset.next()) { NetList allowedList; client.account_fields = new StatsSet(rset, account_field_columns); allowedIps = rset.getString("AllowIPs"); if ((allowedIps != null) && (!(allowedIps.isEmpty())) && (!(allowedIps.equals("*")))) { allowedList = new NetList(); allowedList.LoadFromString(allowedIps, ","); if (!(allowedList.isIpInNets(client.getIpAddress()))) { Status localStatus1 = new Status().setState(State.IP_ACCESS_DENIED); return localStatus1; expected = Base64.decode(rset.getString("password")); access = rset.getInt("accessLevel"); lastServer = rset.getInt("lastServer"); if (lastServer <= 0) lastServer = 1; // minServerId is 1 in Interlude if (Config.DEBUG) _log.fine("account exists"); } rset.close(); statement.close();
but this code wrong
Re: Account block ip
Posted: Fri Jul 31, 2009 5:45 am
by momo61
streamsss wrote:It is possible to realise the account block on IP?
To add new column Allow_IP, to bring pair of changes in a login, etc.
Very useful thing for protection gm an account.
sorry for my bad english.
true. If you have like a norwegian server, and you have a norwegian head GM with high access, it would be more secure to allow only IPs from norway to enter that account =)
cool idea ^^