devilbox/.devilbox/www/htdocs/db_redis.php

102 lines
2.7 KiB
PHP
Raw Normal View History

2017-04-23 12:08:54 +00:00
<?php require '../config.php'; ?>
<?php loadClass('Helper')->authPage(); ?>
2018-12-10 12:55:01 +00:00
<?php
if (isset($_GET['redisdb'])) {
loadClass('Redis')->flushDB($_GET['redisdb']);
loadClass('Helper')->redirect('/db_redis.php');
}
?>
2017-04-23 12:08:54 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
2017-05-15 06:56:17 +00:00
<?php echo loadClass('Html')->getHead(); ?>
2017-04-23 12:08:54 +00:00
</head>
<body>
2017-05-15 06:56:17 +00:00
<?php echo loadClass('Html')->getNavbar(); ?>
2017-04-23 12:08:54 +00:00
<div class="container">
<h1>Redis Keys</h1>
<br/>
<br/>
2018-12-10 12:55:01 +00:00
<?php $databases = array_keys(loadClass('Redis')->getKeys()); ?>
<?php if (count($databases)): ?>
<div class="row">
<div class="col-md-12">
<form class="form-inline">
<div class="form-group">
<label class="sr-only" for="redisdb">Redis DB</label>
<select class="form-control" name="redisdb">
<option value="" selected disabled>Select Redis DB</option>
<?php foreach ($databases as $db): ?>
<option value="<?php echo $db;?>"><?php echo $db;?></option>
<?php endforeach; ?>
</select>
</div>&nbsp;&nbsp;
<button type="submit" class="btn btn-primary">Flush database</button>
</form>
<br/>
</div>
</div>
<?php endif; ?>
2017-04-23 12:08:54 +00:00
<div class="row">
<div class="col-md-12">
2017-05-15 06:56:17 +00:00
<?php if (!loadClass('Redis')->isAvailable()): ?>
2017-05-08 07:43:43 +00:00
<p>Redis container is not running.</p>
<?php else: ?>
<table class="table table-striped ">
<tbody>
2018-12-10 12:55:01 +00:00
<?php $redisKeys = loadClass('Redis')->getKeys(); ?>
<?php if (count($redisKeys)): ?>
<?php foreach ($redisKeys as $db_name => $keys): ?>
<tr class="thead-inverse ">
<th colspan="5">
Database: <?php echo $db_name; ?>&nbsp;&nbsp;&nbsp;&nbsp;
Items: <?php echo count($keys); ?>
</th>
2018-08-12 08:26:51 +00:00
</th>
2018-12-10 12:55:01 +00:00
<tr class="table-info">
<tr>
<th>DB</th>
<th>Key</th>
<th>Expires</th>
<th>Type</th>
<th>Value</th>
</th>
2018-08-12 08:26:51 +00:00
</tr>
2018-12-10 12:55:01 +00:00
<?php foreach ($keys as $key): ?>
<tr>
<td><?php echo $db_name;?></td>
<td class="break-word" style="width:30%;"><?php echo $key['name'];?></td>
<td><?php echo $key['ttl'];?>s</td>
<td><?php echo $key['type'];?></td>
<td class="break-word">
<code>
<?php echo htmlentities($key['val']);?>
</code>
</td>
</tr>
<?php endforeach; ?>
2018-08-12 08:26:51 +00:00
2018-12-10 12:55:01 +00:00
<?php endforeach; ?>
<?php else: ?>
<p>No keys set.</p>
<?php endif; ?>
2017-05-08 07:43:43 +00:00
</tbody>
</table>
<?php endif; ?>
2017-04-23 12:08:54 +00:00
</div>
</div>
</div><!-- /.container -->
2017-05-15 06:56:17 +00:00
<?php echo loadClass('Html')->getFooter(); ?>
2017-04-23 12:08:54 +00:00
</body>
</html>