POST request logging eingebunden

This commit is contained in:
xoy 2023-01-28 23:09:31 +01:00
parent 60059fb6b0
commit 628de87946
2 changed files with 30 additions and 0 deletions

View File

@ -19,6 +19,20 @@ func getEvents() []event {
return events
}
func getEventCount() int {
db := ctdoConnect()
row := dbQuerry(db, "SELECT COUNT(*) FROM events;")
count := 0
for row.Next() {
row.Scan(&count)
}
return count
}
func addEvent(Event event) bool {
db := ctdoConnect()

16
http.go
View File

@ -24,6 +24,22 @@ func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string)
if r.Method == "POST" {
err := r.ParseForm()
errorPanic(err)
if filepath == "./web/pages/admin/dashboard.html" {
title := r.FormValue("title")
description := r.FormValue("description")
files := r.FormValue("media")
date := r.FormValue("date")
if title != "" && description != "" && files != "" && date != "" {
logger("----------------POST----------------")
logger("title: " + title)
logger("descrtiption: " + description)
logger("media: " + files)
logger("date: " + date)
logger("----------------POST END----------------")
}
}
}
logger(r.Method + " request -> " + readHttpYML() + "/" + urlPath + " <" + contentType + ">")