Cody Cook
8b4dfe0c0c
All checks were successful
SonarQube Scan / SonarQube Trigger (push) Successful in 37s
13 lines
446 B
PHP
13 lines
446 B
PHP
<?php
|
|
session_start();
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'darkmode') {
|
|
$darkmode = $_POST['value'] === 'true' ? 'true' : 'false';
|
|
$_SESSION['darkmode'] = $darkmode; // Update the session to reflect the new mode
|
|
|
|
// Send a JSON response back to JavaScript
|
|
header('Content-Type: application/json');
|
|
echo json_encode(['darkmode' => $darkmode]);
|
|
exit;
|
|
}
|