Ai
7 Star 5 Fork 3

Gitee 极速下载/phpredisadmin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/ErikDubbelboer/phpRedisAdmin
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
import.php 2.38 KB
一键复制 编辑 原始数据 按行查看 历史
Karel Wintersky 提交于 2022-10-30 01:24 +08:00 . Fix #187 issue (comma in keys) (#188)
<?php
require_once 'includes/common.inc.php';
global $redis, $config, $csrfToken, $server;
// This mess could need some cleanup!
if (isset($_POST['commands'])) {
// Append some spaces at the end to make sure we always have enough arguments for the last function.
$commands = str_getcsv(str_replace(array("\r", "\n"), array('', ' '), $_POST['commands']).' ', ' ');
foreach ($commands as &$command) {
$command = stripslashes($command);
}
unset($command);
for ($i = 0; $i < count($commands); ++$i) {
if (empty($commands[$i])) {
continue;
}
$commands[$i] = strtoupper($commands[$i]);
switch ($commands[$i]) {
case 'SET': {
$redis->set($commands[$i+1], $commands[$i+2]);
$i += 2;
break;
}
case 'HSET': {
$redis->hSet($commands[$i+1], $commands[$i+2], $commands[$i+3]);
$i += 3;
break;
}
case 'LPUSH': {
$redis->lPush($commands[$i+1], $commands[$i+2]);
$i += 2;
break;
}
case 'RPUSH': {
$redis->rPush($commands[$i+1], $commands[$i+2]);
$i += 2;
break;
}
case 'LSET': {
$redis->lSet($commands[$i+1], $commands[$i+2], $commands[$i+3]);
$i += 3;
break;
}
case 'SADD': {
$redis->sAdd($commands[$i+1], $commands[$i+2]);
$i += 2;
break;
}
case 'ZADD': {
$redis->zAdd($commands[$i+1], $commands[$i+2], $commands[$i+3]);
$i += 3;
break;
}
}
}
// Refresh the top so the key tree is updated.
require 'includes/header.inc.php';
?>
<script>
top.location.href = top.location.pathname+'?overview&s=<?php echo $server['id']?>&d=<?php echo $server['db']?>';
</script>
<?php
require 'includes/footer.inc.php';
die;
}
$page['css'][] = 'frame';
$page['js'][] = 'frame';
require 'includes/header.inc.php';
?>
<h2>Import</h2>
<form action="<?php echo format_html(getRelativePath('import.php'))?>" method="post">
<input type="hidden" name="csrf" value="<?php echo $csrfToken; ?>" />
<p>
<label for="commands">Commands:<br>
<br>
<span class="info">
Valid are:<br>
SET<br>
HSET<br>
LPUSH<br>
RPUSH<br>
LSET<br>
SADD<br>
ZADD
</span>
</label>
<textarea name="commands" id="commands" cols="80" rows="20"></textarea>
</p>
<input type="submit" class="button" value="Import">
</form>
<?php
require 'includes/footer.inc.php';
?>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/mirrors/phpredisadmin.git
git@gitee.com:mirrors/phpredisadmin.git
mirrors
phpredisadmin
phpredisadmin
master

搜索帮助