Apply Case insentitive while getting a player through database only to

disable multi-accounts
This commit is contained in:
Xephi 2014-09-05 19:36:38 +02:00
parent 53437ed33c
commit 38b3197356
3 changed files with 6 additions and 7 deletions

View File

@ -58,7 +58,7 @@ public class FlatFileThread extends Thread implements DataSource {
String line;
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
if (args.length > 1 && args[0].equals(user)) {
if (args.length > 1 && args[0].equalsIgnoreCase(user)) {
return true;
}
}
@ -426,7 +426,7 @@ public class FlatFileThread extends Thread implements DataSource {
String line;
while ((line = br.readLine()) != null) {
String[] args = line.split(":");
if (args[0].equals(user)) {
if (args[0].equalsIgnoreCase(user)) {
switch (args.length) {
case 2:
return new PlayerAuth(args[0], args[1], "198.18.0.1", 0, "your@email.com");

View File

@ -171,8 +171,7 @@ public class MySQLThread extends Thread implements DataSource {
ResultSet rs = null;
try {
con = makeSureConnectionIsReady();
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnName + "=?;");
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWEST(" + columnName + ")=LOWEST(?);");
pst.setString(1, user);
rs = pst.executeQuery();
return rs.next();
@ -198,7 +197,7 @@ public class MySQLThread extends Thread implements DataSource {
int id = -1;
try {
con = makeSureConnectionIsReady();
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnName + "=?;");
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWEST(" + columnName + ")=LOWEST(?);");
pst.setString(1, user);
rs = pst.executeQuery();
if (rs.next()) {

View File

@ -131,7 +131,7 @@ public class SQLiteThread extends Thread implements DataSource {
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnName + "=?");
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWEST(" + columnName + ")=LOWEST(?);");
pst.setString(1, user);
rs = pst.executeQuery();
return rs.next();
@ -149,7 +149,7 @@ public class SQLiteThread extends Thread implements DataSource {
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE " + columnName + "=?;");
pst = con.prepareStatement("SELECT * FROM " + tableName + " WHERE LOWEST(" + columnName + ")=LOWEST(?);");
pst.setString(1, user);
rs = pst.executeQuery();
if (rs.next()) {