aboutsummaryrefslogtreecommitdiff
path: root/src/com/juick/server/UserQueries.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/juick/server/UserQueries.java')
-rw-r--r--src/com/juick/server/UserQueries.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/com/juick/server/UserQueries.java b/src/com/juick/server/UserQueries.java
index 906f7742..bd392ade 100644
--- a/src/com/juick/server/UserQueries.java
+++ b/src/com/juick/server/UserQueries.java
@@ -121,11 +121,11 @@ public class UserQueries {
PreparedStatement stmt = null;
ResultSet rs = null;
try {
- stmt = sql.prepareStatement("SELECT logins.hash FROM logins WHERE user_id=?");
+ stmt = sql.prepareStatement("SELECT hash FROM logins WHERE user_id=?");
stmt.setInt(1, uid);
rs = stmt.executeQuery();
if (rs.first()) {
- hash = rs.getString(2);
+ hash = rs.getString(1);
}
} catch (SQLException e) {
System.err.println(e);
@@ -235,4 +235,25 @@ public class UserQueries {
}
return ret;
}
+
+ public static boolean isInWL(Connection sql, int uid, int check) {
+ boolean ret = false;
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT 1 FROM wl_users WHERE user_id=? AND wl_user_id=?");
+ stmt.setInt(1, uid);
+ stmt.setInt(2, check);
+ rs = stmt.executeQuery();
+ if (rs.first()) {
+ ret = rs.getInt(1) == 1;
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+ return ret;
+ }
}