From 86ab15795222d4cd355ea35743bae9d2fa8c8844 Mon Sep 17 00:00:00 2001 From: richonguzman Date: Tue, 19 Sep 2023 09:46:18 -0300 Subject: [PATCH] testing more --- src/LoRa_APRS_iGate.cpp | 2 +- src/utils.cpp | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/LoRa_APRS_iGate.cpp b/src/LoRa_APRS_iGate.cpp index 7bae289..bd28739 100644 --- a/src/LoRa_APRS_iGate.cpp +++ b/src/LoRa_APRS_iGate.cpp @@ -20,7 +20,7 @@ Configuration Config; WiFiClient espClient; -String versionDate = "2023.09.15"; +String versionDate = "2023.09.19"; int myWiFiAPIndex = 0; int myWiFiAPSize = Config.wifiAPs.size(); WiFi_AP *currentWiFi = &Config.wifiAPs[myWiFiAPIndex]; diff --git a/src/utils.cpp b/src/utils.cpp index e767e9b..de1e39a 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -43,7 +43,9 @@ extern String versionDate; extern uint32_t lastWiFiCheck; extern bool WiFiConnect; -const char* PARAM_MESSAGE = "message"; +String name; +String email; +//const char* PARAM_MESSAGE = "message"; namespace Utils { @@ -288,12 +290,19 @@ void startServer() { server.on("/process_form.php", HTTP_POST, [](AsyncWebServerRequest *request){ String message; - if (request->hasParam(PARAM_MESSAGE, true)) { - message = request->getParam(PARAM_MESSAGE, true)->value(); + + if (request->hasParam("email", true) && request->hasParam("name", true)) { + email = request->getParam("email", true)->value(); + name = request->getParam("name", true)->value(); + + String responseMessage = "Received EMAIL: " + email + ", NAME: " + name; + + // Assuming you're sending an HTTP response, for example, in an HTTP server context + request->send(200, "text/plain", responseMessage); } else { - message = "No message sent"; + // Handle the case where one or both parameters are missing + request->send(400, "text/plain", "Both EMAIL and NAME parameters are required."); } - request->send(200, "text/plain", "Hello, POST: " + message); }); server.onNotFound(notFound);