X-Git-Url: https://git.treefish.org/wirbrennen/flipacoin.git/blobdiff_plain/3b3d3fe4ea7feca2525038b4f44cb1f0b6b7b37c..b2900427fcc70eef171c1547e69477b22896bc1e:/flipacoin.cgi?ds=sidebyside diff --git a/flipacoin.cgi b/flipacoin.cgi index 95bf6c1..15ac6a4 100755 --- a/flipacoin.cgi +++ b/flipacoin.cgi @@ -19,6 +19,7 @@ sub printpage { $template->param(COINLIFETIME => $COINLIFETIME); $template->param(FLIPPEDCOINSINDB => $flippedcoinsindb); $template->param(COINSINDB => $coinsindb); + $template->param(HTTP_HOST => $ENV{HTTP_HOST}); print "Content-type: text/html\n\n", $template->output; } @@ -85,7 +86,6 @@ elsif ( length($requestedcoinid) == 0 && $requestedaction eq "create" ) { $template = HTML::Template->new(filename => 'created.html'); $template->param(NEWCOINID => $newcoinid); - $template->param(HTTP_HOST => $ENV{HTTP_HOST}); } elsif ( length($requestedcoinid) > 0 ) { if ( ! exists $coins_db{$requestedcoinid} ) { @@ -98,22 +98,22 @@ elsif ( length($requestedcoinid) > 0 ) { $template = HTML::Template->new(filename => 'usecoin.html'); $template->param(REQUESTEDCOINID => $requestedcoinid); - $template->param(HTTP_HOST => $ENV{HTTP_HOST}); $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])); } }