24 lines
578 B
PHP
24 lines
578 B
PHP
<?php
|
|
session_start();
|
|
require_once 'db/config.php';
|
|
|
|
if (!isset($_SESSION['user_id']) || $_SESSION['user_role'] !== 'client') {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$client_id = $_SESSION['user_id'];
|
|
$timezone = $_POST['timezone'] ?? 'UTC';
|
|
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare("UPDATE clients SET timezone = ? WHERE id = ?");
|
|
$stmt->execute([$timezone, $client_id]);
|
|
|
|
header('Location: dashboard.php?status=settings_updated');
|
|
exit;
|
|
} else {
|
|
header('Location: dashboard.php');
|
|
exit;
|
|
}
|