diff --git a/honk.go b/honk.go index e6425cc..49cdaa5 100644 --- a/honk.go +++ b/honk.go @@ -789,11 +789,32 @@ func savebonk(w http.ResponseWriter, r *http.Request) { } func zonkit(w http.ResponseWriter, r *http.Request) { - xid := r.FormValue("xid") + wherefore := r.FormValue("wherefore") + var what string + switch wherefore { + case "this honk": + what = r.FormValue("honk") + wherefore = "zonk" + case "this honker": + what = r.FormValue("honker") + wherefore = "zonker" + case "this convoy": + what = r.FormValue("convoy") + wherefore = "zonvoy" + } + if what == "" { + return + } - log.Printf("zonking %s", xid) + log.Printf("zonking %s %s", wherefore, what) userinfo := login.GetUserInfo(r) - stmtZonkIt.Exec(userinfo.UserID, xid) + if wherefore == "zonk" { + stmtZonkIt.Exec(userinfo.UserID, what) + } else { + db := opendatabase() + db.Exec("insert into zonkers (userid, name, wherefore) values (?, ?, ?)", + userinfo.UserID, what, wherefore) + } } func savehonk(w http.ResponseWriter, r *http.Request) { diff --git a/views/honk.html b/views/honk.html index 30383ca..83aa855 100644 --- a/views/honk.html +++ b/views/honk.html @@ -25,10 +25,24 @@ convoy: {{ .Convoy }} {{ end }} {{ end }} -{{ if and .Bonk (not (eq .Honk.What "zonked")) }} +{{ if and .BonkCSRF (not (eq .Honk.What "zonked")) }}
+
{{ end }} diff --git a/views/honkpage.html b/views/honkpage.html index cb2ccc2..90a7dba 100644 --- a/views/honkpage.html +++ b/views/honkpage.html @@ -24,11 +24,19 @@