Visa Källkod

The following files exist in this folder. Click to view.

NamnTypStorlek
actions.phpPHP Fil7.9 KB
admin.phpPHP Fil13.7 KB
auth.phpPHP Fil4.5 KB
change_password.phpPHP Fil4.1 KB
check_login.phpPHP Fil911 B
index.phpPHP Fil4 KB
json_store.phpPHP Fil2.1 KB
transactions.jsonJSON Fil4.6 KB
users.jsonJSON Fil1.5 KB

check_login.php

40 lines ISO-8859-1 BOM Windows (CRLF) - Type: PHP Fil
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
<?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;
}

?>