View sourcecode

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

history.php

65 lines UTF-8 Unix (LF)
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
<?php

session_start
();

?>

<!DOCTYPE html>
<html lang="sv">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Historik</title>
    <link rel="stylesheet" href="/spectre/spectre-master/dist/spectre.css">
    <style>
        .hContainer {
            border: 1px solid black;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.5vw;
            }

        .hAmmount{
            flex: 1;
            text-align: left;
            padding-top: 1.5vw;
        }
        .hDate{
            flex: 1;
            text-align: center;
            padding-top: 1.5vw;
        }

        .hAction {
            flex: 1;
            text-align: right;
            padding-top: 1.5vw;
        }

    </style>
</head>
<body style="text-align: center;">
    <br>
    <h1>Historik för "<?php echo"{$_GET["mess"]}"?>"</h1> <!-- $_GET["mess"] innehåller kontonamnet, som skickas via a-taggen på user-sidan -->
    <p>&copySöderbank</p>
    <a href="../user.php" class="btn">Tillbaka</a>
    <br><br>
    <?php
    $file_in
="../accounts/{$_SESSION["username"]}.json";
    
$json=json_decode(file_get_contents($file_in), true);
    foreach(
$json["{$_SESSION["username"]}"] as $t){
        if (
$t["account-name"]==$_GET["mess"]){
            for(
$i=0;$i<=count($t["transactions"])-1$i++){
                echo 
"<div class=\"hContainer\"><p class=\"hAmmount\">Belopp: {$t["transactions"][$i]}kr</p>";
                
$i++;
                echo 
"<p class=\"hDate\">Datum: {$t["transactions"][$i]}</p>";
                
$i++;
                echo 
"<p class=\"hAction\">Händelse: {$t["transactions"][$i]}</p></div>";
            }
        }
    }

    
?>
</body>
</html>