POST request logging eingebunden

This commit is contained in:
xoy 2023-01-28 23:09:31 +01:00
parent 3848ee3010
commit 634668b7d5
2 changed files with 30 additions and 0 deletions

View File

@ -19,6 +19,20 @@ func getEvents() []event {
return events 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 { func addEvent(Event event) bool {
db := ctdoConnect() db := ctdoConnect()

16
http.go
View File

@ -24,6 +24,22 @@ func httpHandleFuncWithPOST(urlPath string, filepath string, contentType string)
if r.Method == "POST" { if r.Method == "POST" {
err := r.ParseForm() err := r.ParseForm()
errorPanic(err) 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 + ">") logger(r.Method + " request -> " + readHttpYML() + "/" + urlPath + " <" + contentType + ">")