]> andersk Git - sql-web.git/blob - tpl/main.php
d3744eba2a51bc7fa0dacc29a8291185b391f47f
[sql-web.git] / tpl / main.php
1 <?php
2
3 include 'head.php';
4
5 if (isset($i_dropask)) {
6         $dropdbs = array_keys($i_dropask);
7         echo '<form method="post" action="', $URI,'">';
8         foreach($dropdbs as $dbname) {
9                 $msg1[] = 'Are you sure you want to drop `'.$dbname.'`? <input style="position:absolute; right:20px;" type="submit" name="drop['.$dbname.']" value="Yes">';
10         }
11         echo '</form>';
12 }
13
14 ?>
15 <h3>Databases</h3>
16
17 <form method="post" action="<?=$URI?>">
18 <?php printErrors($err1); ?>
19 <?php printMsgs($msg1); ?>
20 </form>
21
22 <table width="100%">
23 <form method="post" action="<?=$URI?>">
24 <?php
25         $bytes = $User->getBytes();
26         $usage = $bytes['nBytes'];
27         $total = $bytes['nBytesHard'];
28         if (!count($myDBs)) {
29                 echo '<tr><td width="100%"><em>You have no databases. Add one below.</em></td></tr>';
30         } else
31         foreach($myDBs as $db) {
32                 echo '<tr><td width="100%">';
33                 if ($total>0)
34                         $percentage = $db['nBytes']/$total;
35                 else $percentage = 0;
36                 echo printBar($percentage, $db['Name'], str_replace(' ', '&nbsp;', sprintSize($db['nBytes'])));
37                 echo '</td><td>';
38                 echo '<input type="submit" name="dropask[',$db['Name'],']" value="drop">';
39                 echo '</td></tr>';
40         }
41         if ($total>0) {
42                 $percentage = $usage/$total;
43         } else {
44                 $percentage = 0;
45         }
46         echo '<tr><td colspan=2>';
47         echo '<hr />';
48         echo '</td></tr>';
49         echo '<tr><td colspan=2>';
50         echo printBar($percentage, '<b>TOTAL&nbsp;USED</b>', str_replace(' ', '&nbsp;', sprintSize($usage).' of '.sprintSize($total)));
51         echo '</td></tr>';
52 ?>
53 </form>
54 </table>
55
56 <form method="post" action="<?=$URI?>">
57 <p align="right"><span style="width: 150px;"><label for="p1">new database:</label></span> <input type="text" name="newdb">
58 <input type=submit value="add"></p>
59 </form>
60
61 <h3>Manage Data</h3>
62 <p>One interface we recommend for managing SQL data is <a href="https://scripts.mit.edu/~sql/phpMyAdmin/" target="_blank">phpMyAdmin</a>. Feel free to use it after you've created your databases.</p>
63
64 <?php
65
66 include 'foot.php';
67
68 ?>
This page took 0.026338 seconds and 3 git commands to generate.