View sourcecode

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

deposit.php

45 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
<?php
session_start
();
$file_in="../accounts/{$_SESSION["username"]}.json";
$json json_decode(file_get_contents("$file_in"), true);

?>

<!DOCTYPE html>
<html lang="sv">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Söderbank</title>
    <link rel="stylesheet" href="/spectre/spectre-master/dist/spectre.css">
</head>
<body style="text-align: center; overflow: hidden;">
    <br>
    <h1>Insättning<h1>
    <h5>&copySöderbank</h5>
    <form method="post" action="does_deposit.php">
        <p>
        <label class="form-label" for="d_account">Välj  ett konto:</label>
        <select id="d_account" name="d_account">
            <?php
            
foreach($json["{$_SESSION["username"]}"] as $d){
                
$aSum=0;
                for(
$i=0;$i<=count($d["transactions"])-1;$i+=3){
                    
$aSum += $d["transactions"][$i];
                }
                echo 
"<option value=\"{$d["account-name"]}\">{$d["account-name"]} - $aSum kr</option>";
            }
            
?>
        </select>
        </p>
        <p>
        <label for="d_ammount" class="form-label">Belopp</label><br>
        <input type="number" id="d_ammount" name="d_ammount" required>
        </p>
        <p>
        <input type="submit" name="submit" value="Inkassera" class="btn btn-primary">
        </p>
    </form>
    <a class="btn" href="../user.php">Tillbaka</a>
</body>
</html>