feat: persist display and experimental settings on the db

feat: small styles changed
This commit is contained in:
Miguel Ribeiro
2024-02-22 00:11:08 +01:00
committed by GitHub
parent 3e61711dd4
commit f0a6f1a2f1
15 changed files with 242 additions and 36 deletions
+4 -4
View File
@@ -16,7 +16,7 @@ if ($userCount == 0) {
session_start();
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
$db->close();
header("Location: .");
header("Location: .");
exit();
}
@@ -47,7 +47,7 @@ if (isset($_POST['username']) && isset($_POST['password'])) {
$_SESSION['loggedin'] = true;
$_SESSION['main_currency'] = $main_currency;
$cookieExpire = time() + (30 * 24 * 60 * 60);
setcookie('language', $language, $cookieExpire);
setcookie('language', $language, $cookieExpire);
if ($rememberMe) {
$token = bin2hex(random_bytes(32));
$addLoginTokens = "INSERT INTO login_tokens (user_id, token) VALUES (?, ?)";
@@ -57,10 +57,10 @@ if (isset($_POST['username']) && isset($_POST['password'])) {
$addLoginTokensStmt->execute();
$_SESSION['token'] = $token;
$cookieValue = $username . "|" . $token . "|" . $main_currency;
setcookie('wallos_login', $cookieValue, $cookieExpire);
setcookie('wallos_login', $cookieValue, $cookieExpire);
}
$db->close();
header("Location: .");
header("Location: .");
exit();
} else {
$loginFailed = true;