Commit de4fdf4c authored by Pablo Rauzy's avatar Pablo Rauzy
Browse files

allow sorting by rowid

parent f9a8dbd4
......@@ -61,7 +61,9 @@ function dirsize ($dir) {
}
$db = new SQLite3($config['users']);
$res = $db->query("select name, email, password from users order by name asc");
$orders = array('n' => 'name', 'i' => 'rowid');
$order = (isset($_GET['ord']) ? $orders[$_GET['ord']] : 'name');
$res = $db->query("select rowid, name, email, password from users order by $order asc");
$users = array();
while ($usr = $res->fetchArray(SQLITE3_ASSOC)) {
if ($usr['password'] == '') continue;
......@@ -118,12 +120,15 @@ $db->close();
<h2>Accounts</h2>
<form action="manage.php" method="POST">
<p>
<span>&nbsp;</span>
<span>&nbsp;</span>
<span>Argument:</span>
<span><input type="text" name="arg" id="arg" /></span>
</p>
<p><span><em>Username</em></span><span><em>Disk usage</em></span><span><em>Actions</em></span></p>
<p><span><em><a href="manage.php?ord=i" style="color:inherit;">id</a></em></span><span><em><a href="manage.php?ord=n" style="color:inherit;">Username</a></em></span><span><em>Disk usage</em></span><span><em>Actions</em></span></p>
<?php foreach ($users as $u): ?>
<p>
<span style="color:#aaa;font-size:0.7em;">(<?php echo $u['rowid']; ?>)</span>
<?php if ($config['multidomain']): ?>
<span><a href="https://<?php echo $u['name']; ?>/"><?php echo $u['name']; ?></a></span>
<?php else: ?>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment