function check_field() { $fields = func_get_args(); foreach ($fields as $f) { if ($_REQUEST[$f] == null || trim($_REQUEST[$f]) == '') { exit_print(ucfirst($f) . ' not specified'); } } }
$node2['R'][] = $v; unset($node['R'][$k]); break; } } /* ERROR */ foreach ($node['D'] as $k => $v) { if (!strcasecmp($v['N'], $n)) { $node2['D'][] = $v; $tmp = kv_get($kv, $dir . $v['N'] . '/'); kv_set($kv, $dest . $v['N'] . '/', $tmp); kv_delete($kv, $dir . $v['N'] . '/'); unset($node['D'][$k]); break; } } } kv_set($kv, $dir, serialize($node)); kv_set($kv, $dest, serialize($node2)); break; case 'list': echo '<ul ' . ($dir == '/' ? 'class="root"' : '') . ' id="' . urlencode($dir) . '">'; foreach ($node['D'] as $f) { echo '<li><span id="' . urlencode($dir . $f['N'] . '/') . '" class="expand"></span><input type="checkbox" />' . $f['N'] . '</li>'; } echo '</ul>'; break; default: exit_print('Unkown action.'); break; }
header('Content-Length: ' . $f['S']); header('Content-Disposition: attachment; filename=' . $f['N']); for ($i = 0; $i * 3145728 < $f['S']; $i++) { echo kv_get($kv, $f['I'] . ':' . $i); } //echo kv_get($kv, $path . ':' . $i); exit; } } /* without much usage */ foreach ($node['D'] as $f) { if (!strcasecmp($f['N'], $name)) { exit_redirect('home.php?path=' . $path . '/'); } } exit_print('No such item. ' . $name); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>KVDB-MemStorage - Use MemStorage From SaeKVDB To Save Files</title> <link rel="stylesheet" type="text/css" href="css/view.css" /> <link type="image/x-icon" href="images/favicon.ico" rel="shortcut icon"> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/swfobject.js"></script> <script type="text/javascript" src="js/uploader.js"></script> <script type="text/javascript" src="js/main.js"></script> <script type="text/javascript"> var dir = "<?php
break; case 'login': check_field('username', 'password'); if ($username != $account['username'] || md5($password) != $account['password']) { $_SESSION['msg'] = 'User name or password wrong!'; exit_redirect('index.php'); } $_SESSION['auth'] = 'OK'; exit_redirect('home.php'); break; case 'logout': $_SESSION['auth'] = ''; exit_redirect('index.php'); break; default: exit_print('Action unkown'); break; } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>KVDB-MemStorage - Use MemStorage From SaeKVDB To Save Files</title> <style type="text/css"> body { font: 13px verdana, tahoma, sans-serif; color: #333; } a { text-decoration: none; color: #2323E4; } form { width: 235px; margin: 140px auto; padding: 20px 13px; border: 1px #ddd solid; background: #f7f7f7; margin-bottom: 40px;} li { list-style: none; margin-bottom: 28px; clear: both; padding: 0 8px; } li input { float: right; margin-right: 6px; margin-top: -3px; font-family: verdana, tahoma, sans-serif; } #title { text-align: center; font-size: 16px; color: #2db033; margin-top: 10px; }