protected static int signIn(String username, char[] pword, Connection cnxn) {
		//make sure username, password, and cnxn were passed in
		if (username != null && pword != null && cnxn != null) {
			Statement stmnt;
			ResultSet rs;
			
			try {
				stmnt = cnxn.createStatement();
				
				//get user info from db to compare with entered password
				String query = "SELECT id, password, salt FROM Users WHERE name = '" + username + "'";
				rs = stmnt.executeQuery(query);
				
				//if we got a result the user exists in the db
				if (rs.next()) {
					//get the id from the resultset
					int id = rs.getInt("id");
					
					//get the hashcode from the resultset
					String hashCode = rs.getString("password");
					
					//get the salt from the resultset
					long salt = rs.getLong("salt");
					
					//verify that the user entered the right password
					if (Password.checkPassword(hashCode, salt, pword)) {
						//return the user id if so
						return id;
					} else {
						//return -1 if not
						return -1;
					}
					
				} else {
					//user not in database. TODO: alert user
					return -1;
				}
			} catch (NumberFormatException ex) {
				//resultset didn't return data in the right format. signin failed.
				return -1;
			} catch (SQLException ex) {				
				//problem connecting to db. signin failed.
				return -1;
			}	
		} else {
			//missing necessary input. signin failed.
			return -1;
		}
	}