The following files exist in this folder. Click to view.
| Namn | Typ | Storlek |
|---|---|---|
| actions.php | PHP Fil | 7.9 KB |
| admin.php | PHP Fil | 13.7 KB |
| auth.php | PHP Fil | 4.5 KB |
| change_password.php | PHP Fil | 4.1 KB |
| check_login.php | PHP Fil | 911 B |
| index.php | PHP Fil | 4 KB |
| json_store.php | PHP Fil | 2.1 KB |
| transactions.json | JSON Fil | 4.6 KB |
| users.json | JSON Fil | 1.5 KB |
check_login.php40 lines ISO-8859-1 BOM Windows (CRLF) - Type: PHP Fil
<?php
session_start();
// Tidszom
if (function_exists('date_default_timezone_set')) {
@date_default_timezone_set('Europe/Stockholm');
}
// Kontrollera om användaren är inloggad
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) {
header("Location: index.php?noaccess=1");
exit;
}
require_once 'json_store.php';
// Får användaren från namn från user
$uname = $_SESSION['username'] ?? null;
// Om ancändaren inte inloogad destroy session och omredigera
if (!$uname) {
session_destroy();
header("Location: index.php?noaccess=1");
exit;
}
$users = load_users(); // Läs in alla användare
$found = null;
foreach ($users as $u) {
if (($u['username'] ?? null) === $uname) {
$found = $u;
break;
}
}
if (!$found) {
session_destroy();
header("Location: index.php?noaccess=1");
exit;
}
?>