Updated accounts SQL table to match other branches.
This commit is contained in:
@@ -513,7 +513,7 @@ public class LoginController
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
final String stmt = "UPDATE accounts SET access_level=? WHERE login=?";
|
||||
final String stmt = "UPDATE accounts SET accessLevel=? WHERE login=?";
|
||||
PreparedStatement statement = con.prepareStatement(stmt);
|
||||
statement.setInt(1, banLevel);
|
||||
statement.setString(2, account);
|
||||
@@ -531,7 +531,7 @@ public class LoginController
|
||||
boolean ok = false;
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement("SELECT access_level FROM accounts WHERE login=?");
|
||||
PreparedStatement statement = con.prepareStatement("SELECT accessLevel FROM accounts WHERE login=?");
|
||||
statement.setString(1, user);
|
||||
ResultSet rset = statement.executeQuery();
|
||||
|
||||
@@ -595,14 +595,14 @@ public class LoginController
|
||||
int access = 0;
|
||||
int lastServer = 1;
|
||||
|
||||
PreparedStatement statement = con.prepareStatement("SELECT password, access_level, lastServer FROM accounts WHERE login=?");
|
||||
PreparedStatement statement = con.prepareStatement("SELECT password, accessLevel, lastServer FROM accounts WHERE login=?");
|
||||
statement.setString(1, user);
|
||||
ResultSet rset = statement.executeQuery();
|
||||
|
||||
if (rset.next())
|
||||
{
|
||||
expected = Base64.getDecoder().decode(rset.getString("password"));
|
||||
access = rset.getInt("access_level");
|
||||
access = rset.getInt("accessLevel");
|
||||
lastServer = rset.getInt("lastServer");
|
||||
|
||||
if (lastServer <= 0)
|
||||
@@ -628,7 +628,7 @@ public class LoginController
|
||||
{
|
||||
if ((user != null) && ((user.length()) >= 2) && (user.length() <= 14))
|
||||
{
|
||||
statement = con.prepareStatement("INSERT INTO accounts (login,password,lastactive,access_level,lastIP) values(?,?,?,?,?)");
|
||||
statement = con.prepareStatement("INSERT INTO accounts (login,password,lastactive,accessLevel,lastIP) values(?,?,?,?,?)");
|
||||
statement.setString(1, user);
|
||||
statement.setString(2, Base64.getEncoder().encodeToString(hash));
|
||||
statement.setLong(3, System.currentTimeMillis());
|
||||
@@ -723,7 +723,7 @@ public class LoginController
|
||||
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement("SELECT access_level FROM accounts WHERE login=?");
|
||||
PreparedStatement statement = con.prepareStatement("SELECT accessLevel FROM accounts WHERE login=?");
|
||||
statement.setString(1, user);
|
||||
ResultSet rset = statement.executeQuery();
|
||||
|
||||
|
@@ -162,18 +162,18 @@ public class SQLAccountManager
|
||||
int count = 0;
|
||||
Connection con = null;
|
||||
con = DatabaseFactory.getInstance().getConnection();
|
||||
String q = "SELECT login, access_level FROM accounts ";
|
||||
String q = "SELECT login, accessLevel FROM accounts ";
|
||||
if (m.equals("1"))
|
||||
{
|
||||
q = q.concat("WHERE access_level < 0");
|
||||
q = q.concat("WHERE accessLevel < 0");
|
||||
}
|
||||
else if (m.equals("2"))
|
||||
{
|
||||
q = q.concat("WHERE access_level > 0");
|
||||
q = q.concat("WHERE accessLevel > 0");
|
||||
}
|
||||
else if (m.equals("3"))
|
||||
{
|
||||
q = q.concat("WHERE access_level = 0");
|
||||
q = q.concat("WHERE accessLevel = 0");
|
||||
}
|
||||
q = q.concat(" ORDER BY login ASC");
|
||||
|
||||
@@ -181,7 +181,7 @@ public class SQLAccountManager
|
||||
ResultSet rset = statement.executeQuery();
|
||||
while (rset.next())
|
||||
{
|
||||
System.out.println(rset.getString("login") + " -> " + rset.getInt("access_level"));
|
||||
System.out.println(rset.getString("login") + " -> " + rset.getInt("accessLevel"));
|
||||
count++;
|
||||
}
|
||||
rset.close();
|
||||
@@ -201,7 +201,7 @@ public class SQLAccountManager
|
||||
// Add to Base
|
||||
Connection con = null;
|
||||
con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("REPLACE accounts (login, password, access_level) VALUES (?,?,?)");
|
||||
PreparedStatement statement = con.prepareStatement("REPLACE accounts (login, password, accessLevel) VALUES (?,?,?)");
|
||||
statement.setString(1, account);
|
||||
statement.setString(2, Base64.getEncoder().encodeToString(newpass));
|
||||
statement.setString(3, level);
|
||||
@@ -227,7 +227,7 @@ public class SQLAccountManager
|
||||
{
|
||||
// Exist
|
||||
// Update
|
||||
statement = con.prepareStatement("UPDATE accounts SET access_level=? WHERE login=?;");
|
||||
statement = con.prepareStatement("UPDATE accounts SET accessLevel=? WHERE login=?;");
|
||||
statement.setEscapeProcessing(true);
|
||||
statement.setString(1, level);
|
||||
statement.setString(2, account);
|
||||
|
Reference in New Issue
Block a user