Update main.go

This commit is contained in:
s441433 2018-12-29 04:54:47 +01:00
parent 51b02276b8
commit c1099e75c6

19
main.go
View File

@ -7,6 +7,8 @@ import (
"log"
"net/http"
//"time"
_ "github.com/mattn/go-sqlite3"
)
@ -20,9 +22,10 @@ func opisStołówkaZPM(w http.ResponseWriter, r *http.Request) {
}
func panel(w http.ResponseWriter, r *http.Request) {
fmt.Println("method:", r.Method)
t, _ := template.ParseFiles("panel.gtpl")
t.Execute(w, nil)
//time.Sleep(3 * time.Second)
//fmt.Println("method:", r.Method)
//t, _ := template.ParseFiles("panel.gtpl")
//t.Execute(w, nil)
//***************************************************************************
db, err := sql.Open("sqlite3", "stolowkaZPM.db")
@ -35,16 +38,12 @@ func panel(w http.ResponseWriter, r *http.Request) {
var Password string
var PIN int
var RFID int
fmt.Fprintf(w, "Lista użytkowników:\n")
for rows.Next() {
err = rows.Scan(&IDusers, &User, &Password, &PIN, &RFID)
checkErr(err)
fmt.Printf("%d. %s, %s, %d, %d \n", IDusers, User, Password, PIN, RFID)
fmt.Fprint(w, IDusers)
fmt.Fprint(w, ". ")
fmt.Fprint(w, User)
fmt.Fprint(w, " \n")
fmt.Fprintf(w, "%d. %s \n", IDusers, User)
}
rows.Close()
db.Close()
@ -97,7 +96,7 @@ func login(w http.ResponseWriter, r *http.Request) {
if Password == passwordFROMsite {
fmt.Fprintln(w, zaloguj)
fmt.Fprintln(w, usernameFROMsite)
fmt.Fprintln(w, passwordFROMsite)
//panel(w, r)
break
}
}