Update main.go

This commit is contained in:
s441433 2018-12-28 14:22:11 +01:00
parent 8f12a9fa2b
commit 1a2331bed6

22
main.go
View File

@ -9,18 +9,8 @@ import (
)
func opisStołówkaZPM(w http.ResponseWriter, r *http.Request) {
t, _ := template.ParseFiles("StronaGlowna.tmpl")
t, _ := template.ParseFiles("StronaGlowna.gtpl")
t.Execute(w, nil)
//r.ParseForm()
//fmt.Println(r.Form)
//fmt.Println("path", r.URL.Path)
//fmt.Println("scheme", r.URL.Scheme)
//fmt.Println(r.Form["url_long"])
//for k, v := range r.Form {
// fmt.Println("key:", k)
// fmt.Println("val:", strings.Join(v, ""))
//}
}
func panel(w http.ResponseWriter, r *http.Request) {
@ -30,19 +20,19 @@ func panel(w http.ResponseWriter, r *http.Request) {
}
func login(w http.ResponseWriter, r *http.Request) {
Here:
fmt.Println("method:", r.Method)
if r.Method == "GET" {
t, _ := template.ParseFiles("login.html")
t, _ := template.ParseFiles("login.gtpl")
t.Execute(w, nil)
} else {
r.ParseForm()
fmt.Println("username:", r.Form["username"])
fmt.Println("password:", r.Form["password"])
if len(r.Form["username"][0]) == 0 {
goto Here
}
}
//if r.Method == "POST" {
// t, _ := template.ParseFiles("panel.gtpl")
// t.Execute(w, nil)
//}
username := r.Form["username"]
password := r.Form["password"]
zaloguj := "Wpisane wartości:"