aboutsummaryrefslogtreecommitdiffstats
path: root/index.html
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2012-09-24 11:11:03 -0700
committerAdam Soltys <[email protected]>2012-09-24 11:11:03 -0700
commit6faa6d5e36e64372026e52a838334a3bb2353853 (patch)
treefe03b4c856fc3235de9889199fef19388e54beb0 /index.html
parent5b5053420d59d5cb7b53e905c1e183f37f3d660c (diff)
downloadcoinos-server-6faa6d5e36e64372026e52a838334a3bb2353853.tar.gz
coinos-server-6faa6d5e36e64372026e52a838334a3bb2353853.zip
Basic transaction recording
Diffstat (limited to 'index.html')
-rw-r--r--index.html22
1 files changed, 20 insertions, 2 deletions
diff --git a/index.html b/index.html
index 724cc489..74f190ea 100644
--- a/index.html
+++ b/index.html
@@ -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>