From 9f4927825bb5efeefdff9a2aac05c5b3200f5ef6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 28 Jun 2017 12:32:48 +0300 Subject: move to internal user management because it's impossible to implement proper transparent offline mode with http auth (worker is incapable of authenticating properly) MIGRATION: 1. disable HTTP authentication (this is important!) 2. add two new tables to db/scratch.db (sessions & users) 3. create users via useradm.php (same names and passwords, previous data is kept) --- index.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 59486eb..508148a 100644 --- a/index.php +++ b/index.php @@ -4,9 +4,15 @@ } require_once "config.php"; + require_once "sessions.php"; + require_once "db.php"; - $owner = SQLite3::escapeString($_SERVER["PHP_AUTH_USER"]); + @$owner = SQLite3::escapeString($_SESSION["owner"]); + if (!$owner) { + header("Location: login.php"); + exit; + } if (basename(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)) != 'index.php') { header('Location: index.php'); @@ -27,8 +33,7 @@ die(dirname(SCRATCH_DB) . " directory is not writable"); } - $ldb = new SQLite3(SCRATCH_DB); - $ldb->busyTimeout(30*1000); + $ldb = Db::get(); ?> @@ -85,6 +90,10 @@ +