2016-10-22 15:38:21 +00:00
|
|
|
<?php $CONNECT = TRUE; require '../config.php'; ?>
|
2016-10-09 16:47:49 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
2016-10-22 14:39:08 +00:00
|
|
|
<?php require '../include/head.php'; ?>
|
2016-10-09 16:47:49 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2016-10-22 14:39:08 +00:00
|
|
|
<?php require '../include/navigation.php'; ?>
|
2016-10-09 16:47:49 +00:00
|
|
|
|
|
|
|
<div class="container">
|
|
|
|
|
|
|
|
<h1>Databases</h1>
|
2016-10-22 17:07:09 +00:00
|
|
|
<br/>
|
|
|
|
<br/>
|
2016-10-09 16:47:49 +00:00
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
2016-10-22 15:38:21 +00:00
|
|
|
|
|
|
|
<table class="table table-striped ">
|
|
|
|
<thead class="thead-inverse ">
|
2016-10-09 16:47:49 +00:00
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
2016-10-10 11:06:47 +00:00
|
|
|
<th>Charset</th>
|
|
|
|
<th>Collation</th>
|
2016-10-11 13:45:21 +00:00
|
|
|
<th>Tables</th>
|
2016-10-09 16:47:49 +00:00
|
|
|
<th>Size</th>
|
|
|
|
</th>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2016-10-22 15:38:21 +00:00
|
|
|
<?php foreach (getDatabases() as $name => $keys): ?>
|
2016-10-09 16:47:49 +00:00
|
|
|
<tr>
|
|
|
|
<td><?php echo $name;?></td>
|
2016-10-10 11:06:47 +00:00
|
|
|
<td><?php echo $keys['charset'];?></td>
|
|
|
|
<td><?php echo $keys['collation'];?></td>
|
2016-10-11 13:45:21 +00:00
|
|
|
<td><code><span class="table" id="table-<?php echo $name;?>"> </span></code></td>
|
2016-10-22 16:00:20 +00:00
|
|
|
<td><code><span class="size" id="size-<?php echo $name;?>"> </span></code></td>
|
2016-10-09 16:47:49 +00:00
|
|
|
</tr>
|
2016-10-11 13:45:21 +00:00
|
|
|
<input type="hidden" name="database[]" class="database" value="<?php echo $name;?>" />
|
2016-10-09 16:47:49 +00:00
|
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2016-10-22 14:39:08 +00:00
|
|
|
|
2016-10-09 16:47:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div><!-- /.container -->
|
|
|
|
|
2016-10-11 13:45:21 +00:00
|
|
|
<?php require '../include/footer.php'; ?>
|
2016-10-10 11:06:47 +00:00
|
|
|
<script>
|
|
|
|
// self executing function here
|
|
|
|
(function() {
|
|
|
|
// your page initialization code here
|
|
|
|
// the DOM will be available here
|
|
|
|
|
|
|
|
function updateSizes(database) {
|
|
|
|
var xhttp = new XMLHttpRequest();
|
2016-10-11 13:45:21 +00:00
|
|
|
|
|
|
|
xhttp.onreadystatechange = function() {
|
|
|
|
var fill = '';
|
|
|
|
var res = '';
|
|
|
|
var len;
|
|
|
|
var i;
|
|
|
|
|
|
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
|
|
res = (this.responseText) == 0 ? '0sss MB' : this.responseText+' MB';
|
|
|
|
len = res.length;
|
2016-10-22 16:00:20 +00:00
|
|
|
if (len < 9) {
|
|
|
|
for (i=len; i<9; i++) {
|
2016-10-11 13:45:21 +00:00
|
|
|
fill = ' ' + fill;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
res = res.replace('sss', ' ');
|
|
|
|
res = fill + res;
|
|
|
|
document.getElementById('size-' + database).innerHTML = res;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
xhttp.open('GET', '_ajax_db.php?size=' + database, true);
|
|
|
|
xhttp.send();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function updateCount(database) {
|
|
|
|
var xhttp = new XMLHttpRequest();
|
|
|
|
|
2016-10-10 11:06:47 +00:00
|
|
|
xhttp.onreadystatechange = function() {
|
2016-10-11 13:45:21 +00:00
|
|
|
var fill = '';
|
|
|
|
var i;
|
|
|
|
|
2016-10-10 11:06:47 +00:00
|
|
|
if (this.readyState == 4 && this.status == 200) {
|
2016-10-11 13:45:21 +00:00
|
|
|
if (this.responseText.length < 4) {
|
|
|
|
for (i=this.responseText.length; i<4; i++) {
|
|
|
|
fill = ' ' + fill;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
document.getElementById('table-' + database).innerHTML = fill + this.responseText;
|
2016-10-10 11:06:47 +00:00
|
|
|
}
|
|
|
|
};
|
2016-10-11 13:45:21 +00:00
|
|
|
xhttp.open('GET', '_ajax_db.php?table=' + database, true);
|
2016-10-10 11:06:47 +00:00
|
|
|
xhttp.send();
|
|
|
|
}
|
|
|
|
|
2016-10-11 13:45:21 +00:00
|
|
|
var databases = document.getElementsByName('database[]');
|
2016-10-10 11:06:47 +00:00
|
|
|
var database;
|
2016-10-11 13:45:21 +00:00
|
|
|
|
2016-10-10 11:06:47 +00:00
|
|
|
for (i = 0; i < databases.length; i++) {
|
2016-10-11 13:45:21 +00:00
|
|
|
database = databases[i].value;
|
2016-10-10 11:06:47 +00:00
|
|
|
updateSizes(database);
|
2016-10-11 13:45:21 +00:00
|
|
|
updateCount(database);
|
2016-10-10 11:06:47 +00:00
|
|
|
}
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
|
2016-10-09 16:47:49 +00:00
|
|
|
</body>
|
|
|
|
</html>
|