prijava";
else
echo "";
$passed = [];
if (!empty($_POST["izbriši"]))
$db->exec("delete from stvari where lastnik = '{$_SERVER["PHP_AUTH_USER"]}' and id = '{$_POST["id"]}'");
if (!empty($_POST["dodaj"]) && !empty($_SERVER["PHP_AUTH_USER"]))
$db->exec("insert into stvari (lastnik) values ('{$_SERVER["PHP_AUTH_USER"]}')");
foreach ($_POST as $k => $v)
if (is_numeric($k)) {
foreach ($_POST as $k2 => $v2) {
$sp = strpos($k2, "" . $k);
if ($sp)
$passed[] = substr($k2, 0, $sp);
}
$par = [];
foreach ($passed as $p) {
if (strpos(strtolower($p), "id") === false)
$par[] = "'" . SQLite3::escapeString($p) . "' = '" . SQLite3::escapeString($_POST[$p . $k]) . "'";
}
$s = "update stvari set " . implode(", ", $par) . " where lastnik='{$_SERVER["PHP_AUTH_USER"]}' and id={$k}";
echo $s;
$db->exec($s);
}
if (!empty($_REQUEST["q"]))
$ret = $ro->query("select * from stvari where " . $_REQUEST["q"] . " order by datum desc");
else
$ret = $ro->query("select * from stvari order by datum desc");
$i = 0;
foreach ($ret as $row) {
if ($i == 0)
foreach ($row as $k => $v)
if ($k != "id" && !is_numeric($k))
echo "