aboutsummaryrefslogtreecommitdiffstats
path: root/record_transaction.php
blob: bd858b760f9b415fa24aeb6f109a67ab77db1188 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

$file = 'transactions.json'; 

$transaction = array(
  'address'=> $_GET['address'],
  'date'=> $_GET['date'],
  'received'=> $_GET['received'],
  'exchange'=> $_GET['exchange'],
  'value'=> $_GET['received'] * $_GET['exchange']
);

$json = json_decode(file_get_contents($file));
array_push($json->transactions, $transaction);
file_put_contents($file, json_encode($json));

?>