initial commit
This commit is contained in:
5
reader_data/sarah/data.csv
Executable file
5
reader_data/sarah/data.csv
Executable file
@@ -0,0 +1,5 @@
|
||||
uid,matrikelnummer,name,expire
|
||||
0x40x1f0x440x120x950x540x80,11806418,mike,2033-08-28
|
||||
0x40x320x450xa0x350x4b0x80,11770981,smartie,2033-05-28
|
||||
0x40x670xd0x320x500x380x80,01525520,flix,2033-05-28
|
||||
0x40x4c0x800x320x500x380x80,01326142,pet,2033-05-28
|
||||
|
39
reader_data/sarah/log.csv
Normal file
39
reader_data/sarah/log.csv
Normal file
@@ -0,0 +1,39 @@
|
||||
name,datum
|
||||
|
||||
smartie,13/06/2022 21:00:59
|
||||
smartie,13/06/2022 21:01:11
|
||||
smartie,13/06/2022 21:01:16
|
||||
smartie,13/06/2022 21:06:34
|
||||
smartie,13/06/2022 21:06:42
|
||||
smartie,13/06/2022 21:06:52
|
||||
smartie,13/06/2022 21:06:59
|
||||
smartie,13/06/2022 21:07:07
|
||||
smartie,13/06/2022 21:08:19
|
||||
smartie,13/06/2022 21:08:25
|
||||
smartie,13/06/2022 21:08:33
|
||||
smartie,13/06/2022 21:08:42
|
||||
smartie,13/06/2022 21:09:13
|
||||
smartie,13/06/2022 21:09:23
|
||||
mike,13/06/2022 21:22:39
|
||||
mike,13/06/2022 21:35:26
|
||||
smartie,13/06/2022 21:40:52
|
||||
flix,13/06/2022 21:46:15
|
||||
mike,14/06/2022 10:14:05
|
||||
mike,14/06/2022 10:16:39
|
||||
mike,14/06/2022 10:25:47
|
||||
mike,14/06/2022 12:26:19
|
||||
mike,14/06/2022 12:35:20
|
||||
mike,14/06/2022 13:26:26
|
||||
mike,14/06/2022 13:27:59
|
||||
mike,14/06/2022 13:28:07
|
||||
mike,14/06/2022 13:28:21
|
||||
pet,14/06/2022 13:56:06
|
||||
pet,14/06/2022 14:02:23
|
||||
mike,14/06/2022 15:33:20
|
||||
mike,14/06/2022 16:07:44
|
||||
mike,14/06/2022 16:22:25
|
||||
mike,14/06/2022 16:22:31
|
||||
mike,14/06/2022 17:45:04
|
||||
mike,14/06/2022 18:01:02
|
||||
mike,14/06/2022 18:05:22
|
||||
flix,14/06/2022 19:09:29
|
||||
|
1153
reader_data/sarah/logs/20220614_debug_log.csv
Normal file
1153
reader_data/sarah/logs/20220614_debug_log.csv
Normal file
File diff suppressed because it is too large
Load Diff
205
reader_data/sarah/logs/20220614_entrance_log.csv
Normal file
205
reader_data/sarah/logs/20220614_entrance_log.csv
Normal file
@@ -0,0 +1,205 @@
|
||||
pet,14/06/2022 21:30:46
|
||||
pet,14/06/2022 21:30:51
|
||||
pet,14/06/2022 21:34:09
|
||||
pet,14/06/2022 21:34:10
|
||||
pet,14/06/2022 21:34:11
|
||||
pet,14/06/2022 21:34:12
|
||||
pet,14/06/2022 21:34:13
|
||||
pet,14/06/2022 21:34:14
|
||||
pet,14/06/2022 21:34:15
|
||||
pet,14/06/2022 21:34:16
|
||||
pet,14/06/2022 21:34:18
|
||||
pet,14/06/2022 21:34:19
|
||||
pet,14/06/2022 21:34:20
|
||||
pet,14/06/2022 21:34:21
|
||||
pet,14/06/2022 21:34:22
|
||||
pet,14/06/2022 21:34:23
|
||||
pet,14/06/2022 21:34:24
|
||||
pet,14/06/2022 21:34:25
|
||||
pet,14/06/2022 21:34:26
|
||||
pet,14/06/2022 21:34:27
|
||||
pet,14/06/2022 21:34:28
|
||||
pet,14/06/2022 21:34:29
|
||||
pet,14/06/2022 21:34:30
|
||||
pet,14/06/2022 21:34:31
|
||||
pet,14/06/2022 21:34:32
|
||||
pet,14/06/2022 21:34:34
|
||||
pet,14/06/2022 21:34:35
|
||||
pet,14/06/2022 21:34:36
|
||||
pet,14/06/2022 21:34:37
|
||||
pet,14/06/2022 21:34:38
|
||||
pet,14/06/2022 21:34:39
|
||||
pet,14/06/2022 21:34:40
|
||||
pet,14/06/2022 21:34:41
|
||||
pet,14/06/2022 21:34:42
|
||||
pet,14/06/2022 21:34:43
|
||||
pet,14/06/2022 21:34:44
|
||||
pet,14/06/2022 21:34:45
|
||||
pet,14/06/2022 21:34:46
|
||||
pet,14/06/2022 21:34:47
|
||||
pet,14/06/2022 21:34:48
|
||||
pet,14/06/2022 21:34:50
|
||||
pet,14/06/2022 21:34:51
|
||||
pet,14/06/2022 21:34:52
|
||||
pet,14/06/2022 21:34:53
|
||||
pet,14/06/2022 21:34:54
|
||||
pet,14/06/2022 21:34:55
|
||||
pet,14/06/2022 21:34:56
|
||||
pet,14/06/2022 21:34:57
|
||||
pet,14/06/2022 21:34:58
|
||||
pet,14/06/2022 21:34:59
|
||||
pet,14/06/2022 21:35:00
|
||||
pet,14/06/2022 21:35:01
|
||||
pet,14/06/2022 21:35:02
|
||||
pet,14/06/2022 21:35:03
|
||||
pet,14/06/2022 21:35:04
|
||||
pet,14/06/2022 21:35:05
|
||||
pet,14/06/2022 21:35:07
|
||||
pet,14/06/2022 21:35:08
|
||||
pet,14/06/2022 21:35:09
|
||||
pet,14/06/2022 21:35:10
|
||||
pet,14/06/2022 21:35:11
|
||||
pet,14/06/2022 21:35:12
|
||||
pet,14/06/2022 21:35:13
|
||||
pet,14/06/2022 21:35:14
|
||||
pet,14/06/2022 21:35:15
|
||||
pet,14/06/2022 21:35:16
|
||||
pet,14/06/2022 21:35:17
|
||||
pet,14/06/2022 21:35:18
|
||||
pet,14/06/2022 21:35:19
|
||||
pet,14/06/2022 21:35:20
|
||||
pet,14/06/2022 21:35:21
|
||||
pet,14/06/2022 21:35:23
|
||||
pet,14/06/2022 21:35:24
|
||||
pet,14/06/2022 21:35:25
|
||||
pet,14/06/2022 21:35:26
|
||||
pet,14/06/2022 21:35:27
|
||||
pet,14/06/2022 21:35:28
|
||||
pet,14/06/2022 21:35:29
|
||||
pet,14/06/2022 21:35:30
|
||||
pet,14/06/2022 21:35:31
|
||||
pet,14/06/2022 21:35:32
|
||||
pet,14/06/2022 21:35:33
|
||||
pet,14/06/2022 21:35:34
|
||||
pet,14/06/2022 21:35:35
|
||||
pet,14/06/2022 21:35:36
|
||||
pet,14/06/2022 21:35:37
|
||||
pet,14/06/2022 21:35:38
|
||||
pet,14/06/2022 21:35:39
|
||||
pet,14/06/2022 21:35:41
|
||||
pet,14/06/2022 21:35:42
|
||||
pet,14/06/2022 21:35:43
|
||||
pet,14/06/2022 21:35:44
|
||||
pet,14/06/2022 21:35:45
|
||||
pet,14/06/2022 21:35:46
|
||||
pet,14/06/2022 21:35:47
|
||||
pet,14/06/2022 21:35:48
|
||||
pet,14/06/2022 21:35:49
|
||||
pet,14/06/2022 21:35:50
|
||||
pet,14/06/2022 21:35:51
|
||||
pet,14/06/2022 21:35:52
|
||||
pet,14/06/2022 21:35:53
|
||||
pet,14/06/2022 21:35:54
|
||||
pet,14/06/2022 21:35:55
|
||||
pet,14/06/2022 21:35:56
|
||||
pet,14/06/2022 21:35:57
|
||||
pet,14/06/2022 21:35:59
|
||||
pet,14/06/2022 21:36:00
|
||||
pet,14/06/2022 21:36:01
|
||||
pet,14/06/2022 21:36:02
|
||||
pet,14/06/2022 21:36:03
|
||||
pet,14/06/2022 21:36:04
|
||||
pet,14/06/2022 21:36:05
|
||||
pet,14/06/2022 21:36:06
|
||||
pet,14/06/2022 21:36:07
|
||||
pet,14/06/2022 21:36:08
|
||||
pet,14/06/2022 21:36:09
|
||||
pet,14/06/2022 21:36:10
|
||||
pet,14/06/2022 21:36:11
|
||||
pet,14/06/2022 21:36:12
|
||||
pet,14/06/2022 21:36:13
|
||||
pet,14/06/2022 21:36:14
|
||||
pet,14/06/2022 21:36:16
|
||||
pet,14/06/2022 21:36:17
|
||||
pet,14/06/2022 21:36:18
|
||||
pet,14/06/2022 21:36:19
|
||||
pet,14/06/2022 21:36:20
|
||||
pet,14/06/2022 21:36:21
|
||||
pet,14/06/2022 21:36:22
|
||||
pet,14/06/2022 21:36:23
|
||||
pet,14/06/2022 21:36:24
|
||||
pet,14/06/2022 21:36:25
|
||||
pet,14/06/2022 21:36:26
|
||||
pet,14/06/2022 21:36:27
|
||||
pet,14/06/2022 21:36:28
|
||||
pet,14/06/2022 21:36:29
|
||||
pet,14/06/2022 21:36:30
|
||||
pet,14/06/2022 21:36:31
|
||||
pet,14/06/2022 21:36:33
|
||||
pet,14/06/2022 21:36:34
|
||||
pet,14/06/2022 21:36:35
|
||||
pet,14/06/2022 21:36:36
|
||||
pet,14/06/2022 21:36:37
|
||||
pet,14/06/2022 21:36:38
|
||||
pet,14/06/2022 21:36:39
|
||||
pet,14/06/2022 21:36:40
|
||||
pet,14/06/2022 21:36:41
|
||||
pet,14/06/2022 21:36:42
|
||||
pet,14/06/2022 21:36:43
|
||||
pet,14/06/2022 21:36:44
|
||||
pet,14/06/2022 21:36:45
|
||||
pet,14/06/2022 21:36:46
|
||||
pet,14/06/2022 21:36:47
|
||||
pet,14/06/2022 21:36:48
|
||||
pet,14/06/2022 21:36:49
|
||||
pet,14/06/2022 21:36:50
|
||||
pet,14/06/2022 21:36:52
|
||||
pet,14/06/2022 21:36:53
|
||||
pet,14/06/2022 21:36:54
|
||||
pet,14/06/2022 21:36:58
|
||||
pet,14/06/2022 21:36:59
|
||||
pet,14/06/2022 21:37:00
|
||||
pet,14/06/2022 21:37:01
|
||||
pet,14/06/2022 21:38:01
|
||||
pet,14/06/2022 21:38:02
|
||||
pet,14/06/2022 21:38:03
|
||||
pet,14/06/2022 21:38:04
|
||||
pet,14/06/2022 21:38:05
|
||||
pet,14/06/2022 21:38:06
|
||||
pet,14/06/2022 21:38:07
|
||||
pet,14/06/2022 21:38:08
|
||||
pet,14/06/2022 21:38:09
|
||||
pet,14/06/2022 21:38:10
|
||||
pet,14/06/2022 21:38:11
|
||||
pet,14/06/2022 21:38:13
|
||||
pet,14/06/2022 21:38:14
|
||||
pet,14/06/2022 21:38:15
|
||||
pet,14/06/2022 21:38:16
|
||||
pet,14/06/2022 21:38:17
|
||||
pet,14/06/2022 21:38:18
|
||||
pet,14/06/2022 21:38:19
|
||||
pet,14/06/2022 21:38:20
|
||||
pet,14/06/2022 21:38:21
|
||||
pet,14/06/2022 21:38:22
|
||||
pet,14/06/2022 21:38:23
|
||||
pet,14/06/2022 21:41:29
|
||||
pet,14/06/2022 21:41:30
|
||||
pet,14/06/2022 21:41:31
|
||||
pet,14/06/2022 21:41:32
|
||||
pet,14/06/2022 21:41:33
|
||||
pet,14/06/2022 21:41:34
|
||||
pet,14/06/2022 21:41:35
|
||||
pet,14/06/2022 21:41:36
|
||||
pet,14/06/2022 21:41:47
|
||||
pet,14/06/2022 21:41:48
|
||||
pet,14/06/2022 21:41:49
|
||||
pet,14/06/2022 21:41:50
|
||||
pet,14/06/2022 21:41:51
|
||||
pet,14/06/2022 21:41:52
|
||||
pet,14/06/2022 21:41:53
|
||||
pet,14/06/2022 21:41:54
|
||||
pet,14/06/2022 21:41:55
|
||||
pet,14/06/2022 21:41:56
|
||||
pet,14/06/2022 21:41:57
|
||||
pet,14/06/2022 21:41:59
|
||||
pet,14/06/2022 21:42:00
|
||||
|
5
reader_data/sarah/logs/20220615_data_backup.csv
Executable file
5
reader_data/sarah/logs/20220615_data_backup.csv
Executable file
@@ -0,0 +1,5 @@
|
||||
uid,matrikelnummer,name,expire
|
||||
0x40x1f0x440x120x950x540x80,11806418,mike,2033-08-28
|
||||
0x40x320x450xa0x350x4b0x80,11770981,smartie,2033-05-28
|
||||
0x40x670xd0x320x500x380x80,01525520,flix,2033-05-28
|
||||
0x40x4c0x800x320x500x380x80,01326142,pet,2033-05-28
|
||||
|
44
reader_data/sarah/logs/20220615_debug_log.csv
Normal file
44
reader_data/sarah/logs/20220615_debug_log.csv
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
15/06/2022 10:33:17, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !EXPIRED! no entry!
|
||||
15/06/2022 10:47:29, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !EXPIRED! no entry!
|
||||
|
||||
15/06/2022 10:48:08: Sarah (Simple Access for RFID Authenticated Homes) reader startup.
|
||||
|
||||
|
||||
15/06/2022 10:48:53, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
15/06/2022 10:49:01, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
15/06/2022 10:49:08, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
15/06/2022 10:49:14, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
15/06/2022 10:49:24, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
15/06/2022 10:49:32, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
15/06/2022 10:49:54, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
15/06/2022 10:59:45, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
|
||||
15/06/2022 13:46:38: Sarah (Simple Access for RFID Authenticated Homes) reader startup.
|
||||
|
||||
|
||||
|
||||
15/06/2022 15:32:09: Sarah (Simple Access for RFID Authenticated Homes) reader startup.
|
||||
|
||||
|
||||
15/06/2022 15:32:28, Manual open via website.
|
||||
|
||||
15/06/2022 15:33:11: Sarah (Simple Access for RFID Authenticated Homes) reader startup.
|
||||
|
||||
|
||||
15/06/2022 15:33:16, Manual open via website.
|
||||
15/06/2022 15:33:27, Manual open via website.
|
||||
15/06/2022 15:33:36, Manual open via website.
|
||||
15/06/2022 15:37:42, Reboot executed via website.
|
||||
|
||||
15/06/2022 15:37:56: Sarah (Simple Access for RFID Authenticated Homes) reader startup.
|
||||
|
||||
|
||||
15/06/2022 15:40:01, Reboot executed via website.
|
||||
|
||||
15/06/2022 15:40:15: Sarah (Simple Access for RFID Authenticated Homes) reader startup.
|
||||
|
||||
|
||||
15/06/2022 15:48:31, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
15/06/2022 16:34:25, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
15/06/2022 16:38:31, UID:0x40x1f0x440x120x950x540x80, Name:mike, Matrikelnummer:11806418, !OKAY! access granted.
|
||||
|
11
reader_data/sarah/logs/20220615_entrance_log.csv
Normal file
11
reader_data/sarah/logs/20220615_entrance_log.csv
Normal file
@@ -0,0 +1,11 @@
|
||||
mike,15/06/2022 10:48:57
|
||||
mike,15/06/2022 10:49:05
|
||||
mike,15/06/2022 10:49:12
|
||||
mike,15/06/2022 10:49:18
|
||||
mike,15/06/2022 10:49:28
|
||||
mike,15/06/2022 10:49:36
|
||||
mike,15/06/2022 10:49:58
|
||||
mike,15/06/2022 10:59:49
|
||||
mike,15/06/2022 15:48:35
|
||||
mike,15/06/2022 16:34:29
|
||||
mike,15/06/2022 16:38:35
|
||||
|
21
reader_data/sarah/sarah_crontab_sytem_functions.py
Normal file
21
reader_data/sarah/sarah_crontab_sytem_functions.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
#
|
||||
# this is part of the sarah RFID reader
|
||||
# reader.py if the real file
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
#there is the possibility to restart the raspberry via the website
|
||||
#the webserver saves an emtpy file (manual_restart_machine_request_set) to the disk
|
||||
#if the file is there, we delete the file and reboot the machine
|
||||
if os.path.isfile('/home/zutritt/Documents/sarah/system_request_commands/manual_restart_machine_request_set'):
|
||||
os.remove('/home/zutritt/Documents/sarah/system_request_commands/manual_restart_machine_request_set')
|
||||
#if this file exists, there was a door open request made from the browser
|
||||
debug_file = open("/home/zutritt/Documents/sarah/logs/"+datetime.today().strftime('%Y%m%d')+"_debug_log.csv", "a")
|
||||
debug_file.write("\n"+datetime.now().strftime("%d/%m/%Y %H:%M:%S") + ", Reboot executed via website.")
|
||||
debug_file.close()
|
||||
os.system('sudo reboot')
|
||||
20
reader_data/sarah/src/open.py
Normal file
20
reader_data/sarah/src/open.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import RPi.GPIO as GPIO
|
||||
import board
|
||||
import time
|
||||
import busio
|
||||
from digitalio import DigitalInOut, Direction
|
||||
|
||||
|
||||
def main():
|
||||
PIN_DOOR = 6
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(PIN_DOOR,GPIO.OUT)
|
||||
GPIO.output(PIN_DOOR,False)
|
||||
while True:
|
||||
time.sleep(1)
|
||||
GPIO.output(PIN_DOOR,True)
|
||||
time.sleep(4)
|
||||
GPIO.output(PIN_DOOR,False)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
76
reader_data/sarah/src/pn532_low_power.py
Normal file
76
reader_data/sarah/src/pn532_low_power.py
Normal file
@@ -0,0 +1,76 @@
|
||||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example shows connecting to the PN532 with I2C (requires clock
|
||||
stretching support), SPI, or UART. SPI is best, it uses the most pins but
|
||||
is the most reliable and universally supported. In this example we put the PN532
|
||||
into low power mode and sleep for 1 second in-between trying to read tags.
|
||||
After initialization, try waving various 13.56MHz RFID cards over it!
|
||||
"""
|
||||
|
||||
import time
|
||||
import board
|
||||
import busio
|
||||
import RPi.GPIO as GPIO
|
||||
import pandas as pd
|
||||
|
||||
from digitalio import DigitalInOut
|
||||
|
||||
#
|
||||
# NOTE: pick the import that matches the interface being used
|
||||
#
|
||||
from adafruit_pn532.i2c import PN532_I2C
|
||||
|
||||
# from adafruit_pn532.spi import PN532_SPI
|
||||
# from adafruit_pn532.uart import PN532_UART
|
||||
|
||||
# I2C connection:
|
||||
i2c = busio.I2C(board.SCL, board.SDA)
|
||||
|
||||
# Non-hardware
|
||||
# pn532 = PN532_I2C(i2c, debug=False)
|
||||
|
||||
# With I2C, we recommend connecting RSTPD_N (reset) to a digital pin for manual
|
||||
# harware reset
|
||||
reset_pin = DigitalInOut(board.D6)
|
||||
# On Raspberry Pi, you must also connect a pin to P32 "H_Request" for hardware
|
||||
# wakeup! this means we don't need to do the I2C clock-stretch thing
|
||||
req_pin = DigitalInOut(board.D12)
|
||||
pn532 = PN532_I2C(i2c, debug=False, reset=reset_pin, req=req_pin)
|
||||
|
||||
# SPI connection:
|
||||
# spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
|
||||
# cs_pin = DigitalInOut(board.D5)
|
||||
# pn532 = PN532_SPI(spi, cs_pin, debug=False)
|
||||
|
||||
# UART connection
|
||||
# uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=0.1)
|
||||
# pn532 = PN532_UART(uart, debug=False)
|
||||
|
||||
ic, ver, rev, support = pn532.firmware_version
|
||||
print("Found PN532 with firmware version: {0}.{1}".format(ver, rev))
|
||||
|
||||
# Configure PN532 to communicate with MiFare cards
|
||||
pn532.SAM_configuration()
|
||||
|
||||
df = pd.read_csv('data.csv')
|
||||
|
||||
#for csv_id in data.loc[:,"ID"]:
|
||||
# if("0432450A354B80" in csv_id):
|
||||
# print("yes")
|
||||
|
||||
t = [df.loc[lambda df: df['ID'] == "0432450A354B80"]]
|
||||
t
|
||||
|
||||
print("Waiting for RFID/NFC card...")
|
||||
|
||||
while True:
|
||||
# Check if a card is available to read
|
||||
uid = pn532.read_passive_target(timeout=0.5)
|
||||
print(".", end="")
|
||||
if uid is not None:
|
||||
print("Found card with UID:", [hex(i) for i in uid])
|
||||
print(uid)
|
||||
pn532.power_down()
|
||||
time.sleep(1.0)
|
||||
60
reader_data/sarah/src/pn532_simpletest.py
Normal file
60
reader_data/sarah/src/pn532_simpletest.py
Normal file
@@ -0,0 +1,60 @@
|
||||
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
"""
|
||||
This example shows connecting to the PN532 with I2C (requires clock
|
||||
stretching support), SPI, or UART. SPI is best, it uses the most pins but
|
||||
is the most reliable and universally supported.
|
||||
After initialization, try waving various 13.56MHz RFID cards over it!
|
||||
"""
|
||||
|
||||
import board
|
||||
import busio
|
||||
from digitalio import DigitalInOut
|
||||
|
||||
#
|
||||
# NOTE: pick the import that matches the interface being used
|
||||
#
|
||||
from adafruit_pn532.i2c import PN532_I2C
|
||||
|
||||
# from adafruit_pn532.spi import PN532_SPI
|
||||
# from adafruit_pn532.uart import PN532_UART
|
||||
|
||||
# I2C connection:
|
||||
i2c = busio.I2C(board.SCL, board.SDA)
|
||||
|
||||
# Non-hardware
|
||||
# pn532 = PN532_I2C(i2c, debug=False)
|
||||
|
||||
# With I2C, we recommend connecting RSTPD_N (reset) to a digital pin for manual
|
||||
# harware reset
|
||||
reset_pin = DigitalInOut(board.D6)
|
||||
# On Raspberry Pi, you must also connect a pin to P32 "H_Request" for hardware
|
||||
# wakeup! this means we don't need to do the I2C clock-stretch thing
|
||||
req_pin = DigitalInOut(board.D12)
|
||||
pn532 = PN532_I2C(i2c, debug=False, reset=reset_pin, req=req_pin)
|
||||
|
||||
# SPI connection:
|
||||
# spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
|
||||
# cs_pin = DigitalInOut(board.D5)
|
||||
# pn532 = PN532_SPI(spi, cs_pin, debug=False)
|
||||
|
||||
# UART connection
|
||||
# uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=100)
|
||||
# pn532 = PN532_UART(uart, debug=False)
|
||||
|
||||
ic, ver, rev, support = pn532.firmware_version
|
||||
print("Found PN532 with firmware version: {0}.{1}".format(ver, rev))
|
||||
|
||||
# Configure PN532 to communicate with MiFare cards
|
||||
pn532.SAM_configuration()
|
||||
|
||||
print("Waiting for RFID/NFC card...")
|
||||
while True:
|
||||
# Check if a card is available to read
|
||||
uid = pn532.read_passive_target(timeout=0.5)
|
||||
print(".", end="")
|
||||
# Try again if no card is available.
|
||||
if uid is None:
|
||||
continue
|
||||
print("Found card with UID:", uid)#[i for i in uid])
|
||||
142
reader_data/sarah/src/reader.py
Normal file
142
reader_data/sarah/src/reader.py
Normal file
@@ -0,0 +1,142 @@
|
||||
import RPi.GPIO as GPIO
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import board
|
||||
import busio
|
||||
from digitalio import DigitalInOut, Direction
|
||||
from adafruit_pn532.i2c import PN532_I2C
|
||||
import time
|
||||
from datetime import datetime
|
||||
import os
|
||||
import shutil
|
||||
|
||||
#
|
||||
# This tool was written by Kourosh (aladdin@fet.at) in 2022
|
||||
# and extended by Pet (pet@fet.at) in 6.2022
|
||||
#
|
||||
# It reads the ID from a RFID card and compares it to a stored set of cards
|
||||
# if the card is valid, it pulls a pin HIGH, which in turn opens the door
|
||||
# to the FET lab.
|
||||
#
|
||||
|
||||
def main():
|
||||
|
||||
#create a debug log to print everything that happens into there
|
||||
debug_file = open("/home/zutritt/Documents/sarah/logs/"+datetime.today().strftime('%Y%m%d')+"_debug_log.csv", "a")
|
||||
debug_file.write("\n\n" + datetime.now().strftime("%d/%m/%Y %H:%M:%S") +": Sarah (Simple Access for RFID Authenticated Homes) reader startup. \n\n")
|
||||
debug_file.close()
|
||||
|
||||
|
||||
##set up the hardware
|
||||
i2c = busio.I2C(board.SCL, board.SDA)
|
||||
reset_pin = DigitalInOut(board.D6)
|
||||
req_pin = DigitalInOut(board.D12)
|
||||
pn532 = PN532_I2C(i2c, debug=False, reset=reset_pin, req=req_pin)
|
||||
pn532.SAM_configuration()
|
||||
PIN_DOOR = 6
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.output(PIN_DOOR,False)
|
||||
GPIO.setup(4,GPIO.OUT)
|
||||
GPIO.setup(22,GPIO.OUT)
|
||||
GPIO.setup(5,GPIO.OUT)
|
||||
GPIO.setup(26,GPIO.OUT)
|
||||
GPIO.setup(PIN_DOOR,GPIO.OUT)
|
||||
GPIO.output(4,False)
|
||||
GPIO.output(22,False)
|
||||
GPIO.output(26,False)
|
||||
GPIO.output(PIN_DOOR,False)
|
||||
|
||||
#create a backup of the data file
|
||||
shutil.copy('/home/zutritt/Documents/sarah/data.csv', '/home/zutritt/Documents/sarah/logs/' + datetime.today().strftime('%Y%m%d') + '_data_backup.csv')
|
||||
|
||||
#read the data file once. it will be re-read, if we don't know the UID of a read card or the card is expired.
|
||||
#this saves read/write cycles on the SD card
|
||||
data = pd.read_csv(r'/home/zutritt/Documents/sarah/data.csv') #,names=col_names)
|
||||
|
||||
#mail loop
|
||||
while True:
|
||||
|
||||
#try reading a tag
|
||||
time.sleep(0.5)
|
||||
uid = pn532.read_passive_target(timeout=0.5)
|
||||
#print(uid)
|
||||
|
||||
### DEBUG!!!!!
|
||||
#string = "04 4c 80 32 50 38 81" #pet80
|
||||
#uid = bytearray.fromhex(string)
|
||||
### DEBUG END!!!!
|
||||
|
||||
#there is the possibility to open the door via the website
|
||||
#the webserver saves an emtpy file (manual_door_open_request_set) to the disk
|
||||
#if the file is there, we open the door and delete the file afterwards
|
||||
if os.path.isfile('/home/zutritt/Documents/sarah/system_request_commands/manual_door_open_request_set'):
|
||||
#if this file exists, there was a door open request made from the browser
|
||||
GPIO.output(PIN_DOOR,True)
|
||||
time.sleep(4)
|
||||
GPIO.output(PIN_DOOR,False)
|
||||
debug_file = open("/home/zutritt/Documents/sarah/logs/"+datetime.today().strftime('%Y%m%d')+"_debug_log.csv", "a")
|
||||
debug_file.write("\n"+datetime.now().strftime("%d/%m/%Y %H:%M:%S") + ", Manual open via website.")
|
||||
debug_file.close()
|
||||
with open("/home/zutritt/Documents/sarah/logs/"+ datetime.today().strftime('%Y%m%d') +"_entrance_log.csv", "a") as x:
|
||||
x.write("Manual entry via website, " + datetime.now().strftime("%d/%m/%Y %H:%M:%S") + "\n")
|
||||
x.close()
|
||||
|
||||
os.remove('/home/zutritt/Documents/sarah/system_request_commands/manual_door_open_request_set')
|
||||
|
||||
#after reading a tag, we check if any numbers have been read
|
||||
#no numbers mean no tag has been detected
|
||||
if (not isinstance(uid,bytearray)):
|
||||
continue
|
||||
uid = [hex(i) for i in uid]
|
||||
uid = "".join(uid)
|
||||
|
||||
#write to the debug file that we found a tag
|
||||
debug_file = open("/home/zutritt/Documents/sarah/logs/"+datetime.today().strftime('%Y%m%d')+"_debug_log.csv", "a")
|
||||
debug_file.write("\n"+datetime.now().strftime("%d/%m/%Y %H:%M:%S") + ", UID:" + uid)
|
||||
|
||||
#print (uid)
|
||||
#print (list(data["uid"]))
|
||||
|
||||
# check if the card is anywhere in our saved cards
|
||||
if uid in list(data["uid"]):
|
||||
#save the line where he card is in
|
||||
line = data.query("uid == @uid")
|
||||
print(line)
|
||||
expiration_date = datetime.strptime(str(list(line["expire"])[0]), "%Y-%m-%d")
|
||||
|
||||
#check if the card is expired
|
||||
if datetime.now() < expiration_date:
|
||||
|
||||
#open the door if the card is valid
|
||||
GPIO.output(PIN_DOOR,True)
|
||||
time.sleep(4)
|
||||
GPIO.output(PIN_DOOR,False)
|
||||
|
||||
#log the entry to the entrance log and the debug log
|
||||
with open("/home/zutritt/Documents/sarah/logs/"+ datetime.today().strftime('%Y%m%d') +"_entrance_log.csv", "a") as x:
|
||||
debug_file.write(", Name:" + str(list(line["name"])[0]) + ", Matrikelnummer:" + str(list(line["matrikelnummer"])[0]) + ", !OKAY! access granted.")
|
||||
x.write(str(list(line["name"])[0]) + "," + datetime.now().strftime("%d/%m/%Y %H:%M:%S") + "\n")
|
||||
x.close()
|
||||
|
||||
|
||||
else: #card is expired
|
||||
debug_file.write(", Name:" + str(list(line["name"])[0]) + ", Matrikelnummer:" + str(list(line["matrikelnummer"])[0]) + ", !EXPIRED! no entry!")
|
||||
try:
|
||||
data = pd.read_csv(r'/home/zutritt/Documents/sarah/data.csv') #read the file again, in case something has changed
|
||||
debug_file.write(" (data.csv reloaded)")
|
||||
except OSError as e:
|
||||
debug_file.write(", !data.csv reloaded failed!")
|
||||
|
||||
else:#the card is not in the system
|
||||
debug_file.write(", !No known UID! no entry!")
|
||||
try:
|
||||
data = pd.read_csv(r'/home/zutritt/Documents/sarah/data.csv') #read the file again, in case something has changed
|
||||
debug_file.write(" (data.csv reloaded)")
|
||||
except OSError as e:
|
||||
debug_file.write(", !data.csv reloaded failed!")
|
||||
|
||||
GPIO.output(PIN_DOOR,False)
|
||||
debug_file.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
3
reader_data/sarah/system_request_commands/info.txt
Normal file
3
reader_data/sarah/system_request_commands/info.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
THIS FOLDRE IS MOSTLY EMPTY!
|
||||
der webserver speichert hier files rein wenn er was requesten will, darum sind die permisisons so komisch
|
||||
15.6.22, pet
|
||||
3
website_data/.htpasswd
Normal file
3
website_data/.htpasswd
Normal file
@@ -0,0 +1,3 @@
|
||||
labor:$2y$10$EvX.uUHeCdqYyxibGxdXFeqjmddJoJqxgQwMSz1JWvt7fnhF69vRi
|
||||
zutritt:$2y$10$oTWT3BoFf6K9f6oqGMxYyesU9TvqLjCj.zgBL6dyxdwWK7JVa5aiu
|
||||
admin:$2y$10$oTWT3BoFf6K9f6oqGMxYyesU9TvqLjCj.zgBL6dyxdwWK7JVa5aiu
|
||||
4
website_data/html/.htaccess
Normal file
4
website_data/html/.htaccess
Normal file
@@ -0,0 +1,4 @@
|
||||
AuthType Basic
|
||||
AuthName "Doorknob Login (kein FET/LDAP!)"
|
||||
AuthUserFile /var/www/.htpasswd
|
||||
Require valid-user
|
||||
BIN
website_data/html/FET-Logo.png
Normal file
BIN
website_data/html/FET-Logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
77
website_data/html/access_log.php
Normal file
77
website_data/html/access_log.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head>
|
||||
<meta name="description" content="fet.at - abgesagte Prüfungen">
|
||||
<meta name="author" content="fet.at">
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<meta charset="UTF-8">
|
||||
<title>fet.at - Lab Doorknob</title>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function Ajax()
|
||||
{
|
||||
var
|
||||
$http,
|
||||
$self = arguments.callee;
|
||||
|
||||
if (window.XMLHttpRequest) {
|
||||
$http = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) {
|
||||
try {
|
||||
$http = new ActiveXObject('Msxml2.XMLHTTP');
|
||||
} catch(e) {
|
||||
$http = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
}
|
||||
|
||||
if ($http) {
|
||||
$http.onreadystatechange = function()
|
||||
{
|
||||
if (/4|^complete$/.test($http.readyState)) {
|
||||
document.getElementById('ReloadThis').innerHTML = $http.responseText;
|
||||
setTimeout(function(){$self();}, 1000);
|
||||
}
|
||||
};
|
||||
$http.open('GET', 'get_access_log.php' + '?' + new Date().getTime(), true);
|
||||
$http.send(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>0</script>
|
||||
<div class="breitenbegrenzer">
|
||||
<div class="centertext">
|
||||
<big><big>Sarah <br>ACCESS LOG</big></big><br>
|
||||
<a href="/">
|
||||
<img src="FET-Logo.png" height="100px">
|
||||
<br>
|
||||
HOME</a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
|
||||
Hier wird live das access log angezeigt. <br><br>
|
||||
|
||||
|
||||
Access log:<br>
|
||||
<script type="text/javascript">
|
||||
setTimeout(function() {Ajax();}, 1000);
|
||||
</script>
|
||||
<div id="ReloadThis">Default text</div>
|
||||
|
||||
<div class="centertext">
|
||||
|
||||
<br><br><br>
|
||||
<a href="https://www.fet.at/kontakt">Kontakt</a> <br>fet.at - 2022
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
77
website_data/html/debug_log.php
Normal file
77
website_data/html/debug_log.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head>
|
||||
<meta name="description" content="fet.at - abgesagte Prüfungen">
|
||||
<meta name="author" content="fet.at">
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<meta charset="UTF-8">
|
||||
<title>fet.at - Lab Doorknob</title>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function Ajax()
|
||||
{
|
||||
var
|
||||
$http,
|
||||
$self = arguments.callee;
|
||||
|
||||
if (window.XMLHttpRequest) {
|
||||
$http = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) {
|
||||
try {
|
||||
$http = new ActiveXObject('Msxml2.XMLHTTP');
|
||||
} catch(e) {
|
||||
$http = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
}
|
||||
|
||||
if ($http) {
|
||||
$http.onreadystatechange = function()
|
||||
{
|
||||
if (/4|^complete$/.test($http.readyState)) {
|
||||
document.getElementById('ReloadThis').innerHTML = $http.responseText;
|
||||
setTimeout(function(){$self();}, 1000);
|
||||
}
|
||||
};
|
||||
$http.open('GET', 'get_debug_log.php?lines=20' + '&time=' + new Date().getTime(), true);
|
||||
$http.send(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>0</script>
|
||||
<div class="breitenbegrenzer">
|
||||
<div class="centertext">
|
||||
<big><big>Sarah <br>DEBUG LOG</big></big><br>
|
||||
<a href="/">
|
||||
<img src="FET-Logo.png" height="100px">
|
||||
<br>
|
||||
HOME</a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
|
||||
Hier wird live das debug log angezeigt. <br><br>
|
||||
|
||||
|
||||
Debug log:<br>
|
||||
<script type="text/javascript">
|
||||
setTimeout(function() {Ajax();}, 1000);
|
||||
</script>
|
||||
<div id="ReloadThis">Default text</div>
|
||||
|
||||
<div class="centertext">
|
||||
|
||||
<br><br><br>
|
||||
<a href="https://www.fet.at/kontakt">Kontakt</a> <br>fet.at - 2022
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
BIN
website_data/html/favicon.ico
Normal file
BIN
website_data/html/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
1
website_data/html/favicon.ico.save
Normal file
1
website_data/html/favicon.ico.save
Normal file
@@ -0,0 +1 @@
|
||||
( h 6
|
||||
8
website_data/html/get_access_log.php
Normal file
8
website_data/html/get_access_log.php
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
<?php
|
||||
|
||||
$date_today = date("Ymd");
|
||||
echo "<pre>".shell_exec("tail -20 /home/zutritt/Documents/sarah/logs/".$date_today."_entrance_log.csv")."</pre>";
|
||||
|
||||
|
||||
?>
|
||||
15
website_data/html/get_debug_log.php
Normal file
15
website_data/html/get_debug_log.php
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
<?php
|
||||
|
||||
if(isset($_GET['lines'])) {
|
||||
$lines = $_GET['lines'];
|
||||
}
|
||||
else {
|
||||
$lines = 20;
|
||||
}
|
||||
|
||||
$date_today = date("Ymd");
|
||||
echo "<pre>".shell_exec("tail -". $lines ." /home/zutritt/Documents/sarah/logs/".$date_today."_debug_log.csv")."</pre>";
|
||||
|
||||
|
||||
?>
|
||||
37
website_data/html/index.php
Normal file
37
website_data/html/index.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head>
|
||||
<meta name="description" content="fet.at - abgesagte Prüfungen">
|
||||
<meta name="author" content="fet.at">
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<meta charset="UTF-8">
|
||||
<title>fet.at - Lab Doorknob</title>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>0</script>
|
||||
<div class="breitenbegrenzer">
|
||||
<div class="centertext">
|
||||
<big><big>Sarah <br>(Simple Access for RFID Authenticated Homes)</big></big><br>
|
||||
<img src="FET-Logo.png" height="100px">
|
||||
<br>
|
||||
</div>
|
||||
|
||||
He du!<br>
|
||||
Dies ist das Backend vom doorknob reader. Dieser regelt wer ins FET lab darf und wer nicht. <br>
|
||||
Bei Fragen wende dich gerne ans Lab-Team (lab@fet.at).<br><br>
|
||||
|
||||
<a href="user_management.php">Open User management</a><br>
|
||||
<a href="access_log.php">Open Access log</a><br>
|
||||
<a href="debug_log.php">Open Debug log</a><br>
|
||||
<a href="manual_open.php">Manual door opening</a><br>
|
||||
<a href="system_functions.php">System functions</a><br>
|
||||
|
||||
<div class="centertext">
|
||||
|
||||
<br><br><br>
|
||||
<a href="https://www.fet.at/kontakt">Kontakt</a> <br>pet@fet.at - 2022
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
49
website_data/html/manual_open.php
Normal file
49
website_data/html/manual_open.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head>
|
||||
<meta name="description" content="fet.at - abgesagte Prüfungen">
|
||||
<meta name="author" content="fet.at">
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<meta charset="UTF-8">
|
||||
<title>fet.at - Lab Doorknob</title>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>0</script>
|
||||
<div class="breitenbegrenzer">
|
||||
<div class="centertext">
|
||||
<big><big>Sarah <br>MANUAL OPEN</big></big><br>
|
||||
<a href="/">
|
||||
<img src="FET-Logo.png" height="100px">
|
||||
<br>
|
||||
HOME</a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
Auf Knopfdruck öffnet sich die Tür - Sesam öffne dich. <br><br>
|
||||
|
||||
<?php
|
||||
if(isset($_POST['open_door'])) {
|
||||
$manual_door_open_file = fopen("/home/zutritt/Documents/sarah/system_request_commands/manual_door_open_request_set", "w");
|
||||
fclose($manual_door_open_file);
|
||||
chmod("/home/zutritt/Documents/sarah/system_request_commands/manual_door_open_request_set", 0777); //chmod so that the python script can delete
|
||||
//we just open the file so it exists, no need to write anything to it
|
||||
$date_now = date("Y-m-d H:i:s");
|
||||
echo $date_now.": Door openened.";
|
||||
}
|
||||
?>
|
||||
<form method="post">
|
||||
<input type="submit" name="open_door"
|
||||
value="open door now"/>
|
||||
</form>
|
||||
|
||||
|
||||
<div class="centertext">
|
||||
|
||||
<br><br><br>
|
||||
<a href="https://www.fet.at/kontakt">Kontakt</a> <br>pet@fet.at - 2022
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
14
website_data/html/style.css
Executable file
14
website_data/html/style.css
Executable file
@@ -0,0 +1,14 @@
|
||||
body {
|
||||
background-color:lightgrey;
|
||||
}
|
||||
div.breitenbegrenzer {
|
||||
margin: auto;
|
||||
max-width: 1000px;
|
||||
#text-align: center;
|
||||
|
||||
}
|
||||
|
||||
div.centertext {
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
52
website_data/html/system_functions.php
Normal file
52
website_data/html/system_functions.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head>
|
||||
<meta name="description" content="fet.at - abgesagte Prüfungen">
|
||||
<meta name="author" content="fet.at">
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<meta charset="UTF-8">
|
||||
<title>fet.at - Lab Doorknob</title>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>0</script>
|
||||
<div class="breitenbegrenzer">
|
||||
<div class="centertext">
|
||||
<big><big>Sarah <br>SYSTEM FUNCTIONS</big></big><br>
|
||||
<a href="/">
|
||||
<img src="FET-Logo.png" height="100px">
|
||||
<br>
|
||||
HOME</a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
Es gibt nur eine Systemfunktion: <br>
|
||||
Have you tried turning it off and on again? <br><br>
|
||||
Dauert ca. 3-5min.<br><br>
|
||||
|
||||
|
||||
<?php
|
||||
if(isset($_POST['restart_system'])) {
|
||||
$manual_door_open_file = fopen("/home/zutritt/Documents/sarah/system_request_commands/manual_restart_machine_request_set", "w");
|
||||
fclose($manual_door_open_file);
|
||||
chmod("/home/zutritt/Documents/sarah/system_request_commands/manual_restart_machine_request_set", 0777); //chmod so that the python script can delete
|
||||
//we just open the file so it exists, no need to write anything to it
|
||||
$date_now = date("Y-m-d H:i:s");
|
||||
echo $date_now.": System restart queued. <font color='red'>3-5min dauerts.</font>";
|
||||
}
|
||||
?>
|
||||
<form method="post">
|
||||
<input type="submit" name="restart_system"
|
||||
value="restart_system"/>
|
||||
</form>
|
||||
|
||||
|
||||
<div class="centertext">
|
||||
|
||||
<br><br><br>
|
||||
<a href="https://www.fet.at/kontakt">Kontakt</a> <br>pet@fet.at - 2022
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
103
website_data/html/user_management.php
Normal file
103
website_data/html/user_management.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head>
|
||||
<meta name="description" content="fet.at - abgesagte Prüfungen">
|
||||
<meta name="author" content="fet.at">
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<meta charset="UTF-8">
|
||||
<title>fet.at - Lab Doorknob</title>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function Ajax()
|
||||
{
|
||||
var
|
||||
$http,
|
||||
$self = arguments.callee;
|
||||
|
||||
if (window.XMLHttpRequest) {
|
||||
$http = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) {
|
||||
try {
|
||||
$http = new ActiveXObject('Msxml2.XMLHTTP');
|
||||
} catch(e) {
|
||||
$http = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
}
|
||||
|
||||
if ($http) {
|
||||
$http.onreadystatechange = function()
|
||||
{
|
||||
if (/4|^complete$/.test($http.readyState)) {
|
||||
document.getElementById('ReloadThis').innerHTML = $http.responseText;
|
||||
setTimeout(function(){$self();}, 1000);
|
||||
}
|
||||
};
|
||||
$http.open('GET', 'get_debug_log.php?lines=2' + '&time=' + new Date().getTime(), true);
|
||||
$http.send(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>0</script>
|
||||
<div class="breitenbegrenzer">
|
||||
<div class="centertext">
|
||||
<big><big>Sarah <br>USER MANAGEMENT</big></big><br>
|
||||
<a href="/">
|
||||
<img src="FET-Logo.png" height="100px">
|
||||
<br>
|
||||
HOME</a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
Du kannst berechtigte User_Innen hier anschauen und ändern. <br><br>
|
||||
|
||||
Letzte Zeile aus dem Debug log, damit du die UID rauskopieren kannst:<br>
|
||||
<script type="text/javascript">
|
||||
setTimeout(function() {Ajax();}, 1000);
|
||||
</script>
|
||||
<div id="ReloadThis">Default text</div>
|
||||
|
||||
<?php
|
||||
if (isset($_POST['edit_file'])){
|
||||
$content = $_POST['edit_user_text'];
|
||||
$file = "/home/zutritt/Documents/sarah/data.csv";
|
||||
$Saved_File = fopen($file, 'w');
|
||||
fwrite($Saved_File, $content);
|
||||
fclose($Saved_File);
|
||||
echo "<font color='green'>User file updated:</font>";
|
||||
}
|
||||
else{
|
||||
echo "Komplette Liste:";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<form method="post" action="" id="edit_form">
|
||||
<textarea name="edit_user_text" rows="20" cols="80"><?php
|
||||
echo(htmlspecialchars(file_get_contents("/home/zutritt/Documents/sarah/data.csv")));
|
||||
?></textarea><br>
|
||||
<input type="submit" value="Speichern" name="edit_file">
|
||||
</form>
|
||||
|
||||
<br><br>
|
||||
Alles was da rauslöscht ist weg. Es gibt keine Kontrolle oder jegwelchen sanity-check. Use at you own risk.
|
||||
|
||||
|
||||
<div class="centertext">
|
||||
|
||||
<br><br><br>
|
||||
<a href="https://www.fet.at/kontakt">Kontakt</a> <br>pet@fet.at - 2022
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
121
website_data/html/user_management.php.save
Normal file
121
website_data/html/user_management.php.save
Normal file
@@ -0,0 +1,121 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head>
|
||||
<meta name="description" content="fet.at - abgesagte Prüfungen">
|
||||
<meta name="author" content="fet.at">
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<meta charset="UTF-8">
|
||||
<title>fet.at - Lab Doorknob</title>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function Ajax()
|
||||
{
|
||||
var
|
||||
$http,
|
||||
$self = arguments.callee;
|
||||
|
||||
if (window.XMLHttpRequest) {
|
||||
$http = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) {
|
||||
try {
|
||||
$http = new ActiveXObject('Msxml2.XMLHTTP');
|
||||
} catch(e) {
|
||||
$http = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
}
|
||||
|
||||
if ($http) {
|
||||
$http.onreadystatechange = function()
|
||||
{
|
||||
if (/4|^complete$/.test($http.readyState)) {
|
||||
document.getElementById('ReloadThis').innerHTML = $http.responseText;
|
||||
setTimeout(function(){$self();}, 1000);
|
||||
}
|
||||
};
|
||||
$http.open('GET', 'get_debug_log.php?lines=1' + '&time=' + new Date().getTime(), true);
|
||||
$http.send(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>0</script>
|
||||
<div class="breitenbegrenzer">
|
||||
<div class="centertext">
|
||||
<big><big>Sarah <br>USER MANAGEMENT</big></big><br>
|
||||
<a href="/">
|
||||
<img src="FET-Logo.png" height="100px">
|
||||
<br>
|
||||
HOME</a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
Du kannst berechtigte User_Innen hier anschauen und ändern. <br><br>
|
||||
|
||||
(ÄNDERN IST NOCH NICHT IMPLEMENTIERT, 14.6.22 pet)<br><br>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
if(isset($_POST['name'])) {
|
||||
$add_uid = $_POST['UID'];
|
||||
$add_matrikelnummer = $_POST['matrikelnummer'];
|
||||
$add_name = $_POST['name'];
|
||||
$add_expire = $_POST['expire'];
|
||||
$date_now = date("Y-m-d H:i:s");
|
||||
echo $date_now.": Daten hinzugefügt: ";
|
||||
}
|
||||
?>
|
||||
<form method="post">
|
||||
<label for="fname">Name:</label><br>
|
||||
<input type="text" id="UID" name="UID" value="0x40x4c0x800x320x500x380x80" size="30"><br>
|
||||
<input type="text" id="matrikelnummer" name="matrikelnummer" value="01326142" size="11"><br>
|
||||
<input type="text" id="name" name="name" value="Petra Besser" size="30"><br>
|
||||
<input type="text" id="expire" name="expire" value="2023-06-18" size="10"><br>
|
||||
<input type="submit" value="Submit"/>
|
||||
</form>
|
||||
|
||||
Hier gewünschte ID rauskopieren:<br>
|
||||
<script type="text/javascript">
|
||||
setTimeout(function() {Ajax();}, 1000);
|
||||
</script>
|
||||
<div id="ReloadThis">Default text</div>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
echo '
|
||||
<p style="text-align:left;">
|
||||
<ul>';
|
||||
$handle = fopen("/home/zutritt/Documents/sarah/data.csv", "r");
|
||||
$line = fgets($handle); //dump the first line
|
||||
if ($handle) {
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
[$uid, $matrikelnummer, $name, $expiration_date] = str_getcsv($line);
|
||||
echo '<li>' . 'Matrikelnummer: ' . $matrikelnummer .', Name: ' .$name . ', Ablaufdatum: ' . $expiration_date . ', UID: ' . $uid . '<br></li>';
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
echo '
|
||||
</ul>
|
||||
</p>
|
||||
';
|
||||
?>
|
||||
|
||||
|
||||
<div class="centertext">
|
||||
|
||||
<br><br><br>
|
||||
<a href="https://www.fet.at/kontakt">Kontakt</a> <br>pet@fet.at - 2022
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
121
website_data/html/user_management.php.save.1
Normal file
121
website_data/html/user_management.php.save.1
Normal file
@@ -0,0 +1,121 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head>
|
||||
<meta name="description" content="fet.at - abgesagte Prüfungen">
|
||||
<meta name="author" content="fet.at">
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<meta charset="UTF-8">
|
||||
<title>fet.at - Lab Doorknob</title>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function Ajax()
|
||||
{
|
||||
var
|
||||
$http,
|
||||
$self = arguments.callee;
|
||||
|
||||
if (window.XMLHttpRequest) {
|
||||
$http = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) {
|
||||
try {
|
||||
$http = new ActiveXObject('Msxml2.XMLHTTP');
|
||||
} catch(e) {
|
||||
$http = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
}
|
||||
|
||||
if ($http) {
|
||||
$http.onreadystatechange = function()
|
||||
{
|
||||
if (/4|^complete$/.test($http.readyState)) {
|
||||
document.getElementById('ReloadThis').innerHTML = $http.responseText;
|
||||
setTimeout(function(){$self();}, 1000);
|
||||
}
|
||||
};
|
||||
$http.open('GET', 'get_debug_log.php?lines=1' + '&time=' + new Date().getTime(), true);
|
||||
$http.send(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>0</script>
|
||||
<div class="breitenbegrenzer">
|
||||
<div class="centertext">
|
||||
<big><big>Sarah <br>USER MANAGEMENT</big></big><br>
|
||||
<a href="/">
|
||||
<img src="FET-Logo.png" height="100px">
|
||||
<br>
|
||||
HOME</a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
Du kannst berechtigte User_Innen hier anschauen und ändern. <br><br>
|
||||
|
||||
(ÄNDERN IST NOCH NICHT IMPLEMENTIERT, 14.6.22 pet)<br><br>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
if(isset($_POST['name'])) {
|
||||
$add_uid = $_POST['UID'];
|
||||
$add_matrikelnummer = $_POST['matrikelnummer'];
|
||||
$add_name = $_POST['name'];
|
||||
$add_expire = $_POST['expire'];
|
||||
$date_now = date("Y-m-d H:i:s");
|
||||
echo $date_now.": Daten hinzugefügt: ";
|
||||
}
|
||||
?>
|
||||
<form method="post">
|
||||
<label for="fname">Name:</label><br>
|
||||
<input type="text" id="UID" name="UID" value="0x40x4c0x800x320x500x380x80" size="30"><br>
|
||||
<input type="text" id="matrikelnummer" name="matrikelnummer" value="01326142" size="11"><br>
|
||||
<input type="text" id="name" name="name" value="Petra Besser" size="30"><br>
|
||||
<input type="text" id="expire" name="expire" value="2023-06-18" size="10"><br>
|
||||
<input type="submit" value="Submit"/>
|
||||
</form>
|
||||
|
||||
Hier gewünschte ID rauskopieren:<br>
|
||||
<script type="text/javascript">
|
||||
setTimeout(function() {Ajax();}, 1000);
|
||||
</script>
|
||||
<div id="ReloadThis">Default text</div>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
echo '
|
||||
<p style="text-align:left;">
|
||||
<ul>';
|
||||
$handle = fopen("/home/zutritt/Documents/sarah/data.csv", "r");
|
||||
$line = fgets($handle); //dump the first line
|
||||
if ($handle) {
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
[$uid, $matrikelnummer, $name, $expiration_date] = str_getcsv($line);
|
||||
echo '<li>' . 'Matrikelnummer: ' . $matrikelnummer .', Name: ' .$name . ', Ablaufdatum: ' . $expiration_date . ', UID: ' . $uid . '<br></li>';
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
echo '
|
||||
</ul>
|
||||
</p>
|
||||
';
|
||||
?>
|
||||
|
||||
|
||||
<div class="centertext">
|
||||
|
||||
<br><br><br>
|
||||
<a href="https://www.fet.at/kontakt">Kontakt</a> <br>pet@fet.at - 2022
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
101
website_data/html/user_management.php.save.2
Normal file
101
website_data/html/user_management.php.save.2
Normal file
@@ -0,0 +1,101 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head>
|
||||
<meta name="description" content="fet.at - abgesagte Prüfungen">
|
||||
<meta name="author" content="fet.at">
|
||||
<link href="style.css" rel="stylesheet" type="text/css">
|
||||
<meta charset="UTF-8">
|
||||
<title>fet.at - Lab Doorknob</title>
|
||||
<meta name=viewport content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function Ajax()
|
||||
{
|
||||
var
|
||||
$http,
|
||||
$self = arguments.callee;
|
||||
|
||||
if (window.XMLHttpRequest) {
|
||||
$http = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) {
|
||||
try {
|
||||
$http = new ActiveXObject('Msxml2.XMLHTTP');
|
||||
} catch(e) {
|
||||
$http = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
}
|
||||
}
|
||||
|
||||
if ($http) {
|
||||
$http.onreadystatechange = function()
|
||||
{
|
||||
if (/4|^complete$/.test($http.readyState)) {
|
||||
document.getElementById('ReloadThis').innerHTML = $http.responseText;
|
||||
setTimeout(function(){$self();}, 1000);
|
||||
}
|
||||
};
|
||||
$http.open('GET', 'get_debug_log.php?lines=2' + '&time=' + new Date().getTime(), true);
|
||||
$http.send(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>0</script>
|
||||
<div class="breitenbegrenzer">
|
||||
<div class="centertext">
|
||||
<big><big>Sarah <br>USER MANAGEMENT</big></big><br>
|
||||
<a href="/">
|
||||
<img src="FET-Logo.png" height="100px">
|
||||
<br>
|
||||
HOME</a>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
Du kannst berechtigte User_Innen hier anschauen und ändern. <br><br>
|
||||
|
||||
(ÄNDERN IST NOCH NICHT IMPLEMENTIERT, 14.6.22 pet)<br><br>
|
||||
|
||||
|
||||
Letzte Zeile aus dem Debug log:<br>
|
||||
<script type="text/javascript">
|
||||
setTimeout(function() {Ajax();}, 1000);
|
||||
</script>
|
||||
<div id="ReloadThis">Default text</div>
|
||||
|
||||
<?php
|
||||
if (isset($_POST['edit_file'])){
|
||||
//$content = $_POST['edit_user_text'];
|
||||
//$file = "/home/zutritt/Documents/sarah/data.csv";
|
||||
//$Saved_File = fopen($file, 'w');
|
||||
//fwrite($Saved_File, $content);
|
||||
//fclose($Saved_File);
|
||||
echo "<font color='green'>User file updated:</font>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<form method="post" action="" id="edit_form">
|
||||
Liste:<br>
|
||||
<textarea name="edit_user_text" rows="20" cols="80"><?php
|
||||
echo(htmlspecialchars(file_get_contents("/home/zutritt/Documents/sarah/data.csv")));
|
||||
?></textarea><br>
|
||||
<input type="submit" value="Speichern" name="edit_file">
|
||||
</form>
|
||||
|
||||
|
||||
<div class="centertext">
|
||||
|
||||
<br><br><br>
|
||||
<a href="https://www.fet.at/kontakt">Kontakt</a> <br>pet@fet.at - 2022
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
Reference in New Issue
Block a user