-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.php
More file actions
123 lines (110 loc) · 5.34 KB
/
header.php
File metadata and controls
123 lines (110 loc) · 5.34 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
include_once 'config.php';
include_once 'functions.php';
/** @var array $config */
// Start sesji i generowanie tokena CSRF
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if (empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
$auth = login($config['username'], $config['password']);
$modulesList = [];
if (!empty($auth['token']) && !empty($auth['user_id'])) {
$modulesList = getModules($auth['user_id'], $auth['token']);
}
?>
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<title>Panel <?= htmlspecialchars($config['app_name']) ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap & FontAwesome -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
/* Ukryj strzałki w polach typu number (dla Chrome, Edge, Safari) */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Ukryj strzałki w Firefox */
input[type=number] {
-moz-appearance: textfield;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container-fluid">
<a class="navbar-brand" href="index.php"><i class="fas fa-fire"></i> <?= htmlspecialchars($config['app_name']) ?></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="mainNavbar">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link <?= basename($_SERVER['PHP_SELF']) === 'index.php' ? 'active' : '' ?>" href="index.php">
<i class="fas fa-home"></i> Home
</a>
</li>
<li class="nav-item">
<a class="nav-link <?= basename($_SERVER['PHP_SELF']) === 'modules.php' ? 'active' : '' ?>" href="modules.php">
<i class="fas fa-microchip"></i> Moduły
</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle <?= basename($_SERVER['PHP_SELF']) === 'zones.php' ? 'active' : '' ?>" href="#" role="button" data-bs-toggle="dropdown">
<i class="fas fa-layer-group"></i> Wybierz moduł
</a>
<ul class="dropdown-menu">
<?php if (!empty($modulesList)): ?>
<?php foreach ($modulesList as $mod): ?>
<li>
<a class="dropdown-item" href="zones.php?user_id=<?= urlencode($auth['user_id']) ?>&udid=<?= urlencode($mod['udid']) ?>">
<i class="fas fa-cube text-primary me-1"></i> <?= htmlspecialchars($mod['name'] ?? 'Moduł') ?>
</a>
</li>
<?php endforeach; ?>
<?php else: ?>
<li><span class="dropdown-item text-muted">Brak modułów</span></li>
<?php endif; ?>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle <?= in_array(basename($_SERVER['PHP_SELF']), ['stats.php', 'stats_compare.php']) ? 'active' : '' ?>" href="#" role="button" data-bs-toggle="dropdown">
<i class="fas fa-chart-line"></i> Wykresy
</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item <?= basename($_SERVER['PHP_SELF']) === 'stats.php' ? 'active' : '' ?>" href="stats.php">
<i class="fas fa-chart-area me-2"></i> Dane
</a>
</li>
<li>
<a class="dropdown-item <?= basename($_SERVER['PHP_SELF']) === 'stats_compare.php' ? 'active' : '' ?>" href="stats_compare.php">
<i class="fas fa-balance-scale me-2"></i> Porównanie danych
</a>
</li>
</ul>
</li>
<?php if (isset($_SESSION['username'])): ?>
<li class="nav-item d-flex align-items-center text-white me-2">
<i class="fas fa-user-circle me-1"></i> <?= htmlspecialchars($_SESSION['username']) ?>
</li>
<?php endif; ?>
<li class="nav-item">
<a class="nav-link text-warning" href="logout.php">
<i class="fas fa-sign-out-alt"></i> Wyloguj
</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Zawartość strony zaczyna się tutaj -->
<div class="container mt-4">