From 5142d99463fe7610331756f48f00b7e5216f98d5 Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Sun, 9 Mar 2014 19:31:47 +0100 Subject: [PATCH] Passing state to usecoin.html. --- flipacoin.cgi | 7 ++++--- templates/usecoin.html | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/flipacoin.cgi b/flipacoin.cgi index 95bf6c1..3c35620 100755 --- a/flipacoin.cgi +++ b/flipacoin.cgi @@ -102,18 +102,19 @@ elsif ( length($requestedcoinid) > 0 ) { $template->param(COINCREATIONTIME => localtime($coininfo[0]).""); if ( $coininfosize == 1 && $requestedaction eq "" ) { - $template->param(NOTYETFLIPPED => 1); + $template->param(STATUS_NOTYETFLIPPED => 1); } elsif ( $coininfosize == 1 && $requestedaction eq "flip" ) { $result = int(rand(2)); $coins_db{$requestedcoinid} = $coins_db{$requestedcoinid} . "," . time . "," . $result; - $template->param(COINSTATUS => "Just flipped"); + $template->param(STATUS_JUSTFLIPPED => 1); $template->param(COINRESULT => translateresult($result)); } elsif ( $coininfosize == 3 ) { - $template->param(COINSTATUS => "Flipped @ " . localtime($coininfo[1])); + $template->param(STATUS_FLIPPED => 1); + $template->param(COINFLIPPEDTIME => localtime($coininfo[1]).""); $template->param(COINRESULT => translateresult($coininfo[2])); } } diff --git a/templates/usecoin.html b/templates/usecoin.html index ae6194b..4ebc9de 100644 --- a/templates/usecoin.html +++ b/templates/usecoin.html @@ -9,18 +9,27 @@
- +
 Creation time: 
 Status: Not yet flipped ?action=flip>[flip it]
       
- + + +
 Creation time: 
-Status: 
+Status: Just flipped
 Result: 
       
+ +
+Creation time: 
+Status: Flipped @ 
+Result: 
+      
+ -- 2.39.5