Update main.go
This commit is contained in:
parent
295b80dd3b
commit
caf0ac8323
82
main.go
82
main.go
@ -94,8 +94,8 @@ func wylogowano(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
db.Close()
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
t, _ := template.ParseFiles("wylogowano.gtpl")
|
||||
type user struct {
|
||||
UserView string
|
||||
@ -105,45 +105,6 @@ func wylogowano(w http.ResponseWriter, r *http.Request) {
|
||||
t.ExecuteTemplate(w, "wylogowano.gtpl", u)
|
||||
}
|
||||
|
||||
/*
|
||||
d := struct {
|
||||
loginFROMsiteView string
|
||||
passwordFROMsiteView string
|
||||
IDusersView int
|
||||
UserView string
|
||||
PasswordView string
|
||||
PINView int
|
||||
RFIDView int
|
||||
LoginView string
|
||||
BlokadaView bool
|
||||
KosztView int
|
||||
IDbiletuView int
|
||||
KtoZabralView int
|
||||
DataCzasView string
|
||||
KosztBiletuView int
|
||||
IDdaniaView int
|
||||
NazwaDaniaView string
|
||||
KosztDaniaView int
|
||||
}{
|
||||
loginFROMsiteView: "",
|
||||
passwordFROMsiteView: "",
|
||||
IDusersView: 0,
|
||||
UserView: "",
|
||||
PasswordView: "",
|
||||
PINView: 0,
|
||||
RFIDView: 0,
|
||||
LoginView: "",
|
||||
BlokadaView: Blokada,
|
||||
KosztView: 0,
|
||||
IDbiletuView: 0,
|
||||
KtoZabralView: 0,
|
||||
DataCzasView: "",
|
||||
KosztBiletuView: 0,
|
||||
IDdaniaView: 0,
|
||||
NazwaDaniaView: "",
|
||||
KosztDaniaView: 0}
|
||||
*/
|
||||
|
||||
//#############################################################################
|
||||
func login(w http.ResponseWriter, r *http.Request) {
|
||||
//**************************************************************************
|
||||
@ -390,36 +351,49 @@ func zmianaPINU(w http.ResponseWriter, r *http.Request) {
|
||||
checkErr(err)
|
||||
fmt.Println(dzialanie)
|
||||
|
||||
rows0, err := db.Query("SELECT * FROM users")
|
||||
checkErr(err)
|
||||
|
||||
for rows0.Next() {
|
||||
err = rows0.Scan(&IDusers, &User, &Password, &PIN, &RFID, &Login, &Blokada)
|
||||
checkErr(err)
|
||||
fmt.Printf("%d. %s, %s, %d, %d, %s, %v \n", IDusers, User, Password, PIN, RFID, Login, Blokada)
|
||||
|
||||
}
|
||||
|
||||
rows0.Close()
|
||||
db.Close()
|
||||
|
||||
}
|
||||
if RFIDblockORno == "RFIDblock" {
|
||||
//Blokada := true
|
||||
fmt.Fprintln(w, "*** --- Karta RFID została ZABLOKOWANA! --- *** \n")
|
||||
|
||||
db, err := sql.Open("sqlite3", "stolowkaZPM.db")
|
||||
checkErr(err)
|
||||
|
||||
akt, err := db.Prepare("UPDATE users SET Blokada=? WHERE IDusers=?")
|
||||
checkErr(err)
|
||||
up, err := akt.Exec("true", IDusers)
|
||||
checkErr(err)
|
||||
dzialanie, err := up.RowsAffected()
|
||||
checkErr(err)
|
||||
fmt.Println(dzialanie)
|
||||
|
||||
db.Close()
|
||||
|
||||
} else {
|
||||
if RFIDblockORno == "RFIDunlock" {
|
||||
//Blokada := true
|
||||
fmt.Fprintln(w, "*** --- Karta RFID została ODBLOKOWANA! --- *** \n")
|
||||
|
||||
db, err := sql.Open("sqlite3", "stolowkaZPM.db")
|
||||
checkErr(err)
|
||||
|
||||
akt, err := db.Prepare("UPDATE users SET Blokada=? WHERE IDusers=?")
|
||||
checkErr(err)
|
||||
up, err := akt.Exec("false", IDusers)
|
||||
checkErr(err)
|
||||
dzialanie, err := up.RowsAffected()
|
||||
checkErr(err)
|
||||
fmt.Println(dzialanie)
|
||||
|
||||
db.Close()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
func zmianaHasla(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
//templatka przekierowuje do funkcji wylogowano
|
||||
t, _ := template.ParseFiles("zmianaHasla.gtpl")
|
||||
type zmhaslo struct {
|
||||
UserView string
|
||||
|
Loading…
Reference in New Issue
Block a user