View sourcecode

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

does_make_account.php

24 lines ASCII 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
<?php

session_start
();

$file_in="../accounts/{$_SESSION["username"]}.json";
$json=json_decode(file_get_contents($file_in), true);

foreach(
$json["{$_SESSION["username"]}"]as $a){
    if(
$a["account-name"]==$_POST["kNamn"]){
        
header("location:make_account.php?mess=exists");
        exit();
    }
}

$json["{$_SESSION["username"]}"][] = ["account-type" => "{$_POST["kTyp"]}","account-name" => "{$_POST["kNamn"]}""transactions" => array(0,date("Y/m/d"),"Konto Skapat")];
$file fopen($file_in"w");
fwrite($filejson_encode($jsonJSON_UNESCAPED_UNICODE JSON_PRETTY_PRINT));
fclose($file);

header("location:../user.php");
exit();


?>