public void sendReply_cgibin_logindocgi(MyHTTPServer socket, List<HTTPRequestData> requestData, String host, String cookie) throws Exception
	{
		List<String> reply = new ArrayList<String>();

		addHTTP200(reply, cookie);
		addPageHeader(reply, "");

		String username = getField(requestData, "username");
		String password = getField(requestData, "password");

		boolean valid = true;
		if (username == null || password == null)
			valid = false;
		else if (config.getLDAPUrl() != null) {
			if (LDAP.authenticateUser(config.getLDAPBaseDN(), username, password, config.getLDAPUrl()) == false)
				valid = false;
		}
		else {
			if (username.equals(config.getWebUsername()) == false)
				valid = false;
			if (password.equals(config.getWebPassword()) == false)
				valid = false;
		}

		reply.add("<H1>Login</H1>\n");
		if (valid)
		{
			reply.add("Login success!\n");
			CoffeeSaint.log.add("Session with " + host + " started");
			sessions.add(new HTTPSession(host, cookie));
		}
		else
		{
			reply.add("Login <B>failed</B>.<BR>\n");
			reply.add("<BR>\n");
			reply.add("<A HREF=\"/login.html\">Retry</A><BR>\n");
		}

		addPageTail(reply, false);

		socket.sendReply(reply);
	}