@Override
	public Boolean logIn(String username, String password, String type) {
		boolean userExists = false;
		ResultSet rs;
		String status, actualType;

		System.out.println("Enter log in...");

		try {
			PreparedStatement statement = connection
					.prepareStatement(
							"SELECT * FROM Users "
									+ "WHERE username = ?  AND password = ? AND type = ?",
							ResultSet.TYPE_SCROLL_INSENSITIVE,
							ResultSet.CONCUR_UPDATABLE);

			statement.setString(1, username);
			statement.setString(2, password);
			statement.setString(3, type);

			rs = statement.executeQuery();

			// verify if the user with the given characteristics exists

			while (rs.next()) {
				status = rs.getString(WebServerInfo.status);
				actualType = rs.getString("type");
				
				System.out.println(username + "'s type is " + actualType);
				
				if (!actualType.equals(type)) {
					System.out.println("Type mismatch");
					break;
				}
				
				// update status if user is inactive
				if (status.equals(WebServerInfo.inactive)) {
					userExists = true;
					rs.updateString(WebServerInfo.status, WebServerInfo.active);
					rs.updateRow();
				} else {
					System.out.println("User " + username
							+ " is already logged in");
				}

				break;
			}
			
			rs.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}

		return userExists;
	}