|
29 | 29 |
|
30 | 30 | // String |
31 | 31 | if ($_POST['type'] == 'string') { |
32 | | - $redis->set($_POST['key'], $_POST['value']); |
| 32 | + $redis->set(input_convert($_POST['key']), input_convert($_POST['value'])); |
33 | 33 | } |
34 | 34 |
|
35 | 35 | // Hash |
|
38 | 38 | die('ERROR: Your hash key is to long (max length is '.$config['maxkeylen'].')'); |
39 | 39 | } |
40 | 40 |
|
41 | | - if ($edit && !$redis->hExists($_POST['key'], $_POST['hkey'])) { |
42 | | - $redis->hDel($_POST['key'], $_GET['hkey']); |
| 41 | + if ($edit && !$redis->hExists(input_convert($_POST['key']), input_convert($_POST['hkey']))) { |
| 42 | + $redis->hDel(input_convert($_POST['key']), input_convert($_GET['hkey'])); |
43 | 43 | } |
44 | 44 |
|
45 | | - $redis->hSet($_POST['key'], $_POST['hkey'], $_POST['value']); |
| 45 | + $redis->hSet(input_convert($_POST['key']), input_convert($_POST['hkey']), input_convert($_POST['value'])); |
46 | 46 | } |
47 | 47 |
|
48 | 48 | // List |
49 | 49 | else if (($_POST['type'] == 'list') && isset($_POST['index'])) { |
50 | | - $size = $redis->lLen($_POST['key']); |
| 50 | + $size = $redis->lLen(input_convert($_POST['key'])); |
51 | 51 |
|
52 | 52 | if (($_POST['index'] == '') || |
53 | 53 | ($_POST['index'] == $size) || |
54 | 54 | ($_POST['index'] == -1)) { |
55 | 55 | // Push it at the end |
56 | | - $redis->rPush($_POST['key'], $_POST['value']); |
| 56 | + $redis->rPush(input_convert($_POST['key']), input_convert($_POST['value'])); |
57 | 57 | } else if (($_POST['index'] >= 0) && |
58 | 58 | ($_POST['index'] < $size)) { |
59 | 59 | // Overwrite an index |
60 | | - $redis->lSet($_POST['key'], $_POST['index'], $_POST['value']); |
| 60 | + $redis->lSet(input_convert($_POST['key']), input_convert($_POST['index']), input_convert($_POST['value'])); |
61 | 61 | } else { |
62 | 62 | die('ERROR: Out of bounds index'); |
63 | 63 | } |
|
67 | 67 | else if ($_POST['type'] == 'set') { |
68 | 68 | if ($_POST['value'] != $_POST['oldvalue']) { |
69 | 69 | // The only way to edit a Set value is to add it and remove the old value. |
70 | | - $redis->sRem($_POST['key'], $_POST['oldvalue']); |
71 | | - $redis->sAdd($_POST['key'], $_POST['value']); |
| 70 | + $redis->sRem(input_convert($_POST['key']), input_convert($_POST['oldvalue'])); |
| 71 | + $redis->sAdd(input_convert($_POST['key']), input_convert($_POST['value'])); |
72 | 72 | } |
73 | 73 | } |
74 | 74 |
|
75 | 75 | // ZSet |
76 | 76 | else if (($_POST['type'] == 'zset') && isset($_POST['score'])) { |
77 | 77 | if ($_POST['value'] != $_POST['oldvalue']) { |
78 | 78 | // The only way to edit a ZSet value is to add it and remove the old value. |
79 | | - $redis->zRem($_POST['key'], $_POST['oldvalue']); |
80 | | - $redis->zAdd($_POST['key'], $_POST['score'], $_POST['value']); |
| 79 | + $redis->zRem(input_convert($_POST['key']), input_convert($_POST['oldvalue'])); |
| 80 | + $redis->zAdd(input_convert($_POST['key']), input_convert($_POST['score']), input_convert($_POST['value'])); |
81 | 81 | } |
82 | 82 | } |
83 | 83 |
|
|
0 commit comments