Adds a logout button and script

This commit is contained in:
zontreck 2024-05-16 03:52:45 -07:00
parent 0982ffb504
commit a4ec368d4a
5 changed files with 33 additions and 21 deletions

View file

@ -15,7 +15,7 @@ $password = $js["password"];
$DB = get_DB();
$id = NULLKEY;
$rezday = 0;
$rez = 0;
$title = "";
$login = false;
$reason = "Unauthorized";
@ -26,19 +26,6 @@ if($clientKey == CLIENTPSK) {
// PSK Matches, authorized application
$res = $DB->query("SELECT * FROM `UserAccounts` INNER JOIN `auth` ON `UserAccounts`.`PrincipalID` = `auth`.`UUID` WHERE `FirstName` = '$first' AND `LastName` = '$last';");
/*
*
return User(
ID: UUID.parse(map['id'] as String),
FirstName: map['first'] as String,
LastName: map['last'] as String,
createdAt: map['rezzed'] as int,
userTitle: map['title'] as String);
return S2CLoginResponsePacket(
loggedIn: map['login'] as bool,
reason: map['reason'] as String,
user: User.parseJson(json.encode(map['user'])));
*/
if($res->num_rows > 0) {
$row = $res->fetch_assoc();
@ -51,7 +38,7 @@ if($clientKey == CLIENTPSK) {
$id = $row['UUID'];
$first = $row['FirstName'];
$last = $row['LastName'];
$rezday = $row['createdAt'];
$rez = (int)$row['createdAt'];
$title = $row['UserTitle'];
$active = $row['active'] == 1;
@ -77,7 +64,7 @@ die(json_encode(
"first" => $first,
"last" => $last,
"title" => $title,
"rez" => $rezday,
"rez" => $rez,
"active" => $active
)
)

12
php/Logout.php Normal file
View file

@ -0,0 +1,12 @@
<?php
if(!defined("COMMON"))
require ("Common.php");
session_destroy();
die(json_encode(array(
"done" => true,
"type" => "S2CSimpleReply"
)));
?>