diff options
| author | Adam Soltys <[email protected]> | 2012-09-24 11:11:03 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2012-09-24 11:11:03 -0700 |
| commit | 6faa6d5e36e64372026e52a838334a3bb2353853 (patch) | |
| tree | fe03b4c856fc3235de9889199fef19388e54beb0 /index.html | |
| parent | 5b5053420d59d5cb7b53e905c1e183f37f3d660c (diff) | |
| download | coinos-server-6faa6d5e36e64372026e52a838334a3bb2353853.tar.gz coinos-server-6faa6d5e36e64372026e52a838334a3bb2353853.zip | |
Basic transaction recording
Diffstat (limited to 'index.html')
| -rw-r--r-- | index.html | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -26,6 +26,7 @@ websocket.onmessage = function(e) { var results = eval('(' + e.data + ')'); + var from_address = ''; $.each(results.x.out, function(i, v) { if (v.addr == address) { @@ -34,6 +35,7 @@ }); $.each(results.x.inputs, function(i, v) { + from_address = v.prev_out.addr if (v.prev_out.addr == address) { input -= v.prev_out.value / 100000000; } @@ -43,10 +45,19 @@ if (total <= received) { $('#status').css('color', 'green'); } + + $.get('record_transaction.php', + { + address: from_address, + date: getFormattedDate(), + received: received, + exchange: exchange + } + ); } - $.getJSON('ticker', function (data) { - exchange = data.return.last.value; + $.getJSON('ticker.json', function (data) { + exchange = data.return.last_local.value; $('#exchange').html(exchange); updateTotal(); }); @@ -73,6 +84,13 @@ else return decodeURIComponent(results[1].replace(/\+/g, " ")); } + + function getFormattedDate() { + var date = new Date(); + var str = date.getFullYear() + "-" + date.getMonth() + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds(); + + return str; + } </script> <style> |
