The following files exists in this folder. Click to view.
does_deposit.php47 lines UTF-8 Unix (LF)
<?php
session_start();
$file_out="../accounts/{$_SESSION["username"]}.json";
$json=json_decode(file_get_contents($file_out), true);
if (isset($_POST["d_ammount"])){
foreach($json["{$_SESSION["username"]}"] as &$us){
if($us["account-name"] == $_POST["d_account"]){
array_unshift($us["transactions"], (int)$_POST["d_ammount"], date("Y/m/d"), "insättning");
$file = fopen($file_out, "w");
fwrite($file, json_encode($json, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
fclose($file);
}
}
$_POST["d_ammount"]=null;
}
if (isset($_POST["w_ammount"])){
foreach($json["{$_SESSION["username"]}"] as $us){
if($us["account-name"] == $_POST["w_account"]){
$bSum=0;
for($i=0;$i<=count($us["transactions"])-1;$i+=3){
$bSum += $us["transactions"][$i];
}
}
}
if($_POST["w_ammount"]>$bSum){
$_POST["w_ammount"]=null;
header("location:withdraw.php?mess=HIGH");
exit();
}
else{
foreach($json["{$_SESSION["username"]}"] as &$us){
if($us["account-name"] == $_POST["w_account"]){
array_unshift($us["transactions"], -(int)$_POST["w_ammount"], date("Y/m/d"), "uttag");
$file = fopen($file_out, "w");
fwrite($file, json_encode($json, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
fclose($file);
}
}
$_POST["d_ammount"]=null;
}
}
header("location:../user.php");
exit();
?>