-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
92 lines (84 loc) · 3.37 KB
/
Copy pathindex.php
File metadata and controls
92 lines (84 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
session_start();
require_once 'includes/functions.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['cookie_action'])) {
handleCookieConsent();
}
$page = isset($_GET['page']) ? $_GET['page'] : 'calculator';
$allowedPages = ['calculator', 'about', 'contact'];
if (!in_array($page, $allowedPages)) {
$page = 'calculator';
}
$theme = detectTheme();
$isMobile = isMobile();
?>
<!DOCTYPE html>
<html lang="en" data-theme="<?php echo $theme; ?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<title>Calculator Hub - All-in-One Calculator</title>
<link rel="icon" id="favicon" href="images/logo.svg" type="image/svg+xml">
<link rel="apple-touch-icon" id="appleTouchIcon" href="images/logo.svg">
<link rel="stylesheet" href="styles/main.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body class="<?php echo $isMobile ? 'mobile-device' : ''; ?> page-<?php echo $page; ?>">
<?php include 'includes/header.php'; ?>
<div class="app-container <?php echo ($isMobile && $page === 'calculator') ? 'mobile-calc' : ''; ?>">
<?php include 'includes/sidebar.php'; ?>
<main class="main-content <?php echo ($isMobile && $page === 'calculator') ? 'mobile-calc-full' : ''; ?>">
<?php
switch ($page) {
case 'calculator':
include 'pages/calculator.php';
break;
case 'about':
include 'pages/about.php';
break;
case 'contact':
include 'pages/contact.php';
break;
default:
include 'pages/calculator.php';
}
?>
</main>
</div>
<?php include 'includes/footer.php'; ?>
<?php if (!$isMobile && (!isset($_COOKIE['cookie_consent']) || $_COOKIE['cookie_consent'] === 'pending')): ?>
<div id="cookie-banner" class="cookie-banner">
<div class="cookie-content">
<p>🍪 This site uses cookies to enhance your experience. By continuing, you agree to our use of cookies.</p>
<div class="cookie-actions">
<button onclick="acceptCookies()" class="btn-primary">Accept All</button>
<button onclick="declineCookies()" class="btn-secondary">Decline</button>
<button onclick="customizeCookies()" class="btn-text">Customize</button>
</div>
</div>
</div>
<?php endif; ?>
<script src="js/main.js"></script>
<script>
function acceptCookies() {
setCookieConsent('accepted');
}
function declineCookies() {
setCookieConsent('declined');
}
function customizeCookies() {
setCookieConsent('customized');
}
function setCookieConsent(status) {
fetch('includes/cookie-handler.php', {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: 'action=' + status
}).then(() => {
document.getElementById('cookie-banner').style.display = 'none';
location.reload();
});
}
</script>
</body>
</html>