128 lines
2.4 KiB
PHP
128 lines
2.4 KiB
PHP
<?php
|
|
session_start();
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header("Location: index.php");
|
|
exit;
|
|
}
|
|
|
|
if (!isset($_SESSION['hints'])) {
|
|
$_SESSION['hints'] = 1; // default ON
|
|
}
|
|
|
|
$success = "";
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$_SESSION['hints'] = isset($_POST['hints']) ? 1 : 0;
|
|
|
|
// ❌ Dihapus agar tidak redirect ke menu.php
|
|
// header("Location: menu.php");
|
|
// exit;
|
|
|
|
$success = "Pengaturan berhasil disimpan!";
|
|
}
|
|
|
|
$checked = $_SESSION['hints'] ? "checked" : "";
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Settings - Dam Inggris</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background: #eef2f7;
|
|
height: 100vh;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
margin: 0;
|
|
}
|
|
|
|
.settings-box {
|
|
width: 350px;
|
|
background: white;
|
|
padding: 28px;
|
|
border-radius: 12px;
|
|
text-align: center;
|
|
box-shadow: 0 4px 15px rgba(0,0,0,0.15);
|
|
}
|
|
|
|
h2 {
|
|
color: #0ea5a4;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.toggle {
|
|
margin: 25px 0;
|
|
font-size: 17px;
|
|
color: #333;
|
|
}
|
|
|
|
.success-box {
|
|
padding: 10px;
|
|
background: #d1fae5;
|
|
color: #065f46;
|
|
border-radius: 6px;
|
|
margin-bottom: 15px;
|
|
font-size: 15px;
|
|
font-weight: bold;
|
|
}
|
|
|
|
button {
|
|
padding: 12px 18px;
|
|
font-size: 16px;
|
|
border: none;
|
|
background: #0ea5a4;
|
|
color: white;
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
margin-top: 10px;
|
|
}
|
|
|
|
button:hover {
|
|
background: #0c8c8b;
|
|
}
|
|
|
|
a {
|
|
display: block;
|
|
margin-top: 15px;
|
|
font-size: 14px;
|
|
color: #444;
|
|
text-decoration: none;
|
|
}
|
|
|
|
a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<div class="settings-box">
|
|
<h2>Settings</h2>
|
|
|
|
<!-- Pesan sukses -->
|
|
<?php if (!empty($success)): ?>
|
|
<div class="success-box"><?= $success ?></div>
|
|
<?php endif; ?>
|
|
|
|
<form method="POST" action="settings.php">
|
|
<label class="toggle">
|
|
<input type="checkbox" name="hints" <?= $checked ?>>
|
|
Aktifkan Hints / Arah Petunjuk
|
|
</label>
|
|
|
|
<button type="submit">Simpan</button>
|
|
</form>
|
|
|
|
<a href="menu.php">⬅ Kembali</a>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|