Hide the admin security code
[elbandi:minifaucet.git] / templates / admin.php
1 <?php require 'header.php'; ?>
2
3 <h3>Admin Page</h3>
4 <div class='well'>
5 <?php if (!$isAdmin): ?>
6     <form action='<?php echo urlFor("post_admin"); ?>' method='POST'>
7         <p>Security code</p>
8         <input type='hidden' name='cmd' value='login'>
9         <input type='password' name='seccode'>
10         <div style='margin: 0 auto; width: 318px'>
11             <?php echo $recaptcha; ?>
12         </div>
13         <input type='submit' class='hidead btn btn-success buttonmargin input-block-level' value='Login'>
14     </form>
15 <?php else: ?>
16     <form action='<?php echo urlFor("post_admin"); ?>' method='POST' class='help-inline'>
17         <input type='hidden' name='cmd' value='updatebalance'>
18         <input type='submit' class='hidead btn btn-primary buttonmargin input-block-level' value='Update server balance'>
19     </form>
20     <form action='<?php echo urlFor("post_admin"); ?>' method='POST' class='help-inline'>
21         <input type='hidden' name='cmd' value='logout'>
22         <input type='submit' class='hidead btn btn-success buttonmargin input-block-level' value='Logout'>
23     </form>
24     <br>
25     <b>Server Balance:</b> <?php echo $serverbalance; ?> <?php echo SUB_UNIT_NAME; ?>
26     <ul id="tabs" class="nav nav-pills" data-tabs="tabs">
27         <li class="active"><a data-target="#home" data-toggle="tab">Home</a></li>
28     </ul>
29 <?php endif; ?>
30 </div>
31
32 <?php if ($isAdmin): ?>
33 <div class='well'>
34
35     <div id="my-tab-content" class="tab-content">
36         <div class="tab-pane active" id="home">
37             <h4>Home</h4>
38             <div class="span6">
39                 <table class="well table table-striped">
40                     <caption>Balances</caption>
41                     <tbody><tr>
42                         <td>Number of addresses</td>
43                         <td><span id="summary-addresses"><?php echo $statBalance["num_addresses"];?></span></td>
44                     </tr>
45                     <tr>
46                         <td>Max of balances</td>
47                         <td><span id="summary-max-balance"><?php printf("%s %s",  number_format($statBalance["max_balance"]), SUB_UNIT_NAME); ?></span></td>
48                     </tr>
49                     <tr>
50                         <td>Sum of balances</td>
51                         <td><span id="summary-sum-balance"><?php printf("%s %s",  number_format($statBalance["sum_balance"]), SUB_UNIT_NAME); ?></span></td>
52                     </tr>
53                     <tr>
54                         <td>Max of Total balances</td>
55                         <td><span id="summary-max-total-balance"><?php printf("%s %s",  number_format($statBalance["max_totalbalance"]), SUB_UNIT_NAME); ?></span></td>
56                     </tr>
57                     <tr>
58                         <td>Sum of Total balances</td>
59                         <td><span id="summary-sum-total-balance"><?php printf("%s %s",  number_format($statBalance["sum_totalbalance"]), SUB_UNIT_NAME); ?></span></td>
60                     </tr>
61                 </tbody></table>
62             </div>
63         </div>
64     </div>
65
66 </div>
67 <?php endif; ?>
68
69 <script>
70 $('a[data-toggle="tab"]').on('shown', function (e) {
71     var contentID = $(e.target).attr("data-target");
72     var contentURL = $(e.target).attr("href");
73     if (typeof(contentURL) != 'undefined') {
74         // state: has a url to load from
75         $(contentID).load('<?php echo urlFor("post_admin"); ?>/'+contentURL, function(){
76             $('#myTab').tab(); //reinitialize tabs
77         });
78     }
79 })
80 </script>
81
82 <?php require 'footer.php'; ?>