diff options
author | Ugnich Anton | 2012-10-14 11:34:26 +0700 |
---|---|---|
committer | Ugnich Anton | 2012-10-14 11:34:26 +0700 |
commit | 84de24ebd67552e8f1ee01a377a0437b00a8db0e (patch) | |
tree | f599d2aaa24b81e49b49ae935340c52061994813 /src/com/juick/server/UserQueries.java | |
parent | f656d844d0096cf8637746afaa1fab7dadaef261 (diff) |
Privacy
Diffstat (limited to 'src/com/juick/server/UserQueries.java')
-rw-r--r-- | src/com/juick/server/UserQueries.java | 25 |
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; + } } |