diff options
| author | Adam Soltys <[email protected]> | 2012-10-23 17:29:29 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2012-10-23 17:29:29 +0000 |
| commit | 98ecfec09563811bc65c2bd86b27e77fa2823da0 (patch) | |
| tree | 7acad5c23b92305f1f70e593be39059c544865f2 /record_transaction.php | |
| parent | c4cf80845afd2d7d6862074060c00eceea51bad8 (diff) | |
| parent | b94145ff904315c48781f958f54fae1428ef60e6 (diff) | |
| download | coinos-server-98ecfec09563811bc65c2bd86b27e77fa2823da0.tar.gz coinos-server-98ecfec09563811bc65c2bd86b27e77fa2823da0.zip | |
Merge branch 'master' of https://github.com/asoltys/bitcoin_pos
Diffstat (limited to 'record_transaction.php')
| -rw-r--r-- | record_transaction.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/record_transaction.php b/record_transaction.php index 4640f21d..bd858b76 100644 --- a/record_transaction.php +++ b/record_transaction.php @@ -1,13 +1,17 @@ <?php -$list = array ( - array($_GET['address'], $_GET['date'], $_GET['received'], $_GET['exchange']) -); -$fp = fopen('transactions.csv', 'a'); +$file = 'transactions.json'; + +$transaction = array( + 'address'=> $_GET['address'], + 'date'=> $_GET['date'], + 'received'=> $_GET['received'], + 'exchange'=> $_GET['exchange'], + 'value'=> $_GET['received'] * $_GET['exchange'] +); -foreach ($list as $fields) { - fputcsv($fp, $fields); -} +$json = json_decode(file_get_contents($file)); +array_push($json->transactions, $transaction); +file_put_contents($file, json_encode($json)); -fclose($fp); ?> |
