-
-
Notifications
You must be signed in to change notification settings - Fork 667
/
rename.php
53 lines (35 loc) · 1.29 KB
/
rename.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
require_once 'includes/common.inc.php';
global $redis, $config, $csrfToken, $server;
if (isset($_POST['old'], $_POST['key'])) {
if (strlen($_POST['key']) > $config['maxkeylen']) {
die('ERROR: Your key is to long (max length is '.$config['maxkeylen'].')');
}
$redis->rename($_POST['old'], $_POST['key']);
// Refresh the top so the key tree is updated.
require 'includes/header.inc.php';
?>
<script>
top.location.href = top.location.pathname+'?view&s=<?php echo $server['id']?>&d=<?php echo $server['db']?>&key=<?php echo urlencode($_POST['key'])?>';
</script>
<?php
require 'includes/footer.inc.php';
die;
}
$page['css'][] = 'frame';
$page['js'][] = 'frame';
require 'includes/header.inc.php';
?>
<h2>Edit Name of <?php echo format_html($_GET['key'])?></h2>
<form action="<?php echo format_html(getRelativePath('rename.php'))?>" method="post">
<input type="hidden" name="csrf" value="<?php echo $csrfToken; ?>" />
<input type="hidden" name="old" value="<?php echo format_html($_GET['key'])?>">
<p>
<label for="key">Key:</label>
<input type="text" name="key" id="key" size="30" <?php echo isset($_GET['key']) ? 'value="'.format_html($_GET['key']).'"' : ''?>>
</p>
<input type="submit" class="button" value="Rename">
</form>
<?php
require 'includes/footer.inc.php';
?>