]> andersk Git - sql-web.git/blame - tpl/main.php
Fix CSRF vulnerabilities
[sql-web.git] / tpl / main.php
CommitLineData
dc478ec8
JP
1<?php
2
3include 'head.php';
4
e47be57b
JP
5if (isset($i_dropask)) {
6 $dropdbs = array_keys($i_dropask);
53f8750e 7 echo '<form method="post" action="', $URI,'">';
e47be57b 8 foreach($dropdbs as $dbname) {
e8d03b49 9 $msg1[] = 'Are you sure you want to drop `'.htmlentities($dbname).'`? <input style="position:absolute; right:20px;" type="submit" name="drop['.htmlentities($dbname).']" value="Yes">';
e47be57b
JP
10 }
11 echo '</form>';
12}
13
dc478ec8 14?>
aaf1710a 15<h3>Databases</h3>
1389493c 16
53f8750e 17<form method="post" action="<?=$URI?>">
96f68593 18<input type='hidden' name='csrf_token' value='<?php echo $_SESSION['csrf_token']; ?>'>
9840d102
JP
19<?php printErrors($err1); ?>
20<?php printMsgs($msg1); ?>
e47be57b 21</form>
377015e0 22
88b7d384 23<table width="100%">
53f8750e 24<form method="post" action="<?=$URI?>">
96f68593 25<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>">
2ea5a69f 26<?php
88b7d384
JP
27 $bytes = $User->getBytes();
28 $usage = $bytes['nBytes'];
29 $total = $bytes['nBytesHard'];
9840d102
JP
30 if (!count($myDBs)) {
31 echo '<tr><td width="100%"><em>You have no databases. Add one below.</em></td></tr>';
32 } else
2ea5a69f 33 foreach($myDBs as $db) {
88b7d384 34 echo '<tr><td width="100%">';
88b7d384
JP
35 if ($total>0)
36 $percentage = $db['nBytes']/$total;
37 else $percentage = 0;
7210b384 38 echo printBar($percentage, htmlentities($db['Name']), str_replace(' ', '&nbsp;', sprintSize($db['nBytes'])));
88b7d384 39 echo '</td><td>';
e8d03b49 40 echo '<input type="submit" name="dropask[',htmlentities($db['Name']),']" value="drop">';
88b7d384 41 echo '</td></tr>';
2ea5a69f 42 }
9c70b481 43 if ($total>0) {
88b7d384 44 $percentage = $usage/$total;
9c70b481 45 } else {
88b7d384 46 $percentage = 0;
9c70b481
JP
47 }
48 echo '<tr><td colspan=2>';
49 echo '<hr />';
50 echo '</td></tr>';
51 echo '<tr><td colspan=2>';
52 echo printBar($percentage, '<b>TOTAL&nbsp;USED</b>', str_replace(' ', '&nbsp;', sprintSize($usage).' of '.sprintSize($total)));
53 echo '</td></tr>';
2ea5a69f 54?>
88b7d384
JP
55</form>
56</table>
2ea5a69f 57
53f8750e 58<form method="post" action="<?=$URI?>">
7a5afe9c 59<p align="right"><span style="width: 150px; font-style: italic;"><label for="p1">new database:</label></span> <?=$Login->getUsername()?>+<input type="text" name="newdb">
96f68593 60<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>">
e476b401 61<input type=submit value="add"></p>
377015e0 62</form>
1389493c 63
aaf1710a 64<h3>Manage Data</h3>
da0d337f 65<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>
4a77eeb5 66
dc478ec8
JP
67<?php
68
69include 'foot.php';
70
71?>
This page took 0.065168 seconds and 5 git commands to generate.