public static String authenticateToken(String username, String token)
			throws SQLException {
		String auth_pass = getPassword(username);
		String plain_token = UserServices.decrypt(token,
				UserServices.generateKeys(auth_pass));
		Statement statement = mysqlDB.createStatement();
		ResultSet result = statement
				.executeQuery("select * from v_user_info where Username = '"
						+ username + "'");
		String[] columns = new String[] { "Token" };
		result.first();
		String ret = "";
		for (int i = 0; i < columns.length; i++) {
			ret = result.getString(columns[i]);
		}
		if (plain_token.equals(ret)) {
			if (result.getDate("Start").before(new Date())
					&& result.getDate("End").after(new Date())) {
				return "1";
			}
		}
		statement.close();
		return "0";
	}