$config['maxkeylen']) { die('ERROR: Your key is to long (max length is '.$config['maxkeylen'].')'); } $key = input_convert($_POST['key']); $value = input_convert($_POST['value']); $value = encodeOrDecode('save', $key, $value); if ($value === false || is_null($value)) { die('ERROR: could not encode value'); } // String if ($_POST['type'] == 'string') { $redis->set($key, $value); } // Hash else if (($_POST['type'] == 'hash') && isset($_POST['hkey'])) { if (strlen($_POST['hkey']) > $config['maxkeylen']) { die('ERROR: Your hash key is to long (max length is '.$config['maxkeylen'].')'); } if ($edit && !$redis->hExists($key, input_convert($_POST['hkey']))) { $redis->hDel($key, input_convert($_GET['hkey'])); } $redis->hSet($key, input_convert($_POST['hkey']), $value); } // List else if (($_POST['type'] == 'list') && isset($_POST['index'])) { $size = $redis->lLen($key); if (($_POST['index'] == '') || ($_POST['index'] == $size)) { // Push it at the end $redis->rPush($key, $value); } else if ($_POST['index'] == -1) { // Push it at the start $redis->lPush($key, $value); } else if (($_POST['index'] >= 0) && ($_POST['index'] < $size)) { // Overwrite an index $redis->lSet($key, input_convert($_POST['index']), $value); } else { die('ERROR: Out of bounds index'); } } // Set else if ($_POST['type'] == 'set') { if ($_POST['value'] != $_POST['oldvalue']) { // The only way to edit a Set value is to add it and remove the old value. $redis->sRem($key, encodeOrDecode('save', $key, input_convert($_POST['oldvalue']))); $redis->sAdd($key, $value); } } // ZSet else if (($_POST['type'] == 'zset') && isset($_POST['score'])) { // The only way to edit a ZSet value is to add it and remove the old value. $redis->zRem($key, encodeOrDecode('save', $key, input_convert($_POST['oldvalue']))); $redis->zAdd($key, input_convert($_POST['score']), $value); } // Refresh the top so the key tree is updated. require 'includes/header.inc.php'; ?> get($_GET['key']); } // Hash else if (($_GET['type'] == 'hash') && isset($_GET['hkey'])) { $value = $redis->hGet($_GET['key'], $_GET['hkey']); } // List else if (($_GET['type'] == 'list') && isset($_GET['index'])) { $value = $redis->lIndex($_GET['key'], $_GET['index']); } // Set, ZSet else if ((($_GET['type'] == 'set') || ($_GET['type'] == 'zset')) && isset($_GET['value'])) { $value = $_GET['value']; } $value = encodeOrDecode('load', $_GET['key'], $value); } $page['css'][] = 'frame'; $page['js'][] = 'frame'; require 'includes/header.inc.php'; ?>

>

>

> empty to append, -1 to prepend

>