Added logging for creating and deleting sessions
This commit is contained in:
@@ -7,6 +7,7 @@ if (array_key_exists("get", $_GET)) {
|
||||
$key = $_POST["delete"];
|
||||
dbCommand("DELETE FROM cookies WHERE username='$USERNAME' and cookie='$key'");
|
||||
echo "Deleted session";
|
||||
writeLog(21, "User $USERNAME revoked session with ip $address");
|
||||
} else if (array_key_exists("create", $_POST)) {
|
||||
$expire = intval($_POST["create"]);
|
||||
$cookie = $USERNAME;
|
||||
@@ -14,6 +15,7 @@ if (array_key_exists("get", $_GET)) {
|
||||
$cookie = sanitize(substr(sha1($cookie), 5));
|
||||
dbCommand("INSERT INTO cookies VALUES ('$cookie', '$USERNAME', $expire, '$address')");
|
||||
echo "Created new session";
|
||||
writeLog(22, "User $USERNAME created session with ip $address");
|
||||
} else {
|
||||
http_response_code(400);
|
||||
echo "Invalid command";
|
||||
|
||||
@@ -103,5 +103,15 @@
|
||||
"type": "20",
|
||||
"name": "Backup deleted",
|
||||
"color": "#009966"
|
||||
},
|
||||
{
|
||||
"type": "21",
|
||||
"name": "Session revoked",
|
||||
"color": "#00ccff"
|
||||
},
|
||||
{
|
||||
"type": "22",
|
||||
"name": "Session created",
|
||||
"color": "#00ccff"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user