From 8822fb6f204b6d18a60f460033b4248a08bee5af Mon Sep 17 00:00:00 2001 From: thematdev Date: Thu, 6 Jul 2023 17:10:22 +0300 Subject: [PATCH] Allow only POST to post --- src/new_client.c | 3 ++- src/view_comments.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/new_client.c b/src/new_client.c index be5a65a..fd2002f 100644 --- a/src/new_client.c +++ b/src/new_client.c @@ -67,7 +67,8 @@ int cgiMain() { char *message; - if (cgiFormSubmitClicked("login") == cgiFormSuccess) { + if (cgiFormSubmitClicked("login") == cgiFormSuccess && + !strcmp(cgiRequestMethod, "POST")) { message = validate_credentials(); } else { message = ""; diff --git a/src/view_comments.c b/src/view_comments.c index 46b8695..802e868 100644 --- a/src/view_comments.c +++ b/src/view_comments.c @@ -238,7 +238,8 @@ cgiMain() fprintf(cgiOut, "\n"); - if (cgiFormSubmitClicked("submit") == cgiFormSuccess) { + if (cgiFormSubmitClicked("submit") == cgiFormSuccess && + !strcmp(cgiRequestMethod, "POST")) { handle_submitted_comment(); }