- char *data = getenv("QUERY_STRING");
- if (data) {
- printf("<br>Query string is: '%s'\n", data);
- }
- }
+ if (!strcmp("sensors", module)) {
+ module_handler = SensorsHandler; //Replace with pointer to sensors handler
+ } else if (!strcmp("admin"), module) {
+ module_handler = NULL; //Replace with pointer to admin handler
+ printf("Admin module selected!\n");
+ }
+
+ if (module_handler) {
+ printf("Content-type: text/html\r\n\r\n"); //Replace with actual type
+ module_handler(data, params);
+ } else {
+ printf("Status: 400 Bad Request\r\n"
+ "Content-type: text/html\r\n\r\n"
+ "<title>400 Bad Request</title>\n"
+ "Unknown module '%s' selected.<br>\n",
+ module);
+ }
+
+ //Debgging:
+ printf("Module: %s, Params: %s<br>\n", module, params);
+ printf("Request number %d, host <i>%s</i>\n",
+ count++, getenv("SERVER_HOSTNAME"));
+ }