From 177aa840f0b180219ec6e87410f30eb9d31d3c06 Mon Sep 17 00:00:00 2001 From: woon Date: Wed, 12 Apr 2023 13:49:17 +0800 Subject: [PATCH] update --- public/index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index 1607d26..67b6dde 100644 --- a/public/index.php +++ b/public/index.php @@ -263,7 +263,7 @@ function api_upload() $uuid = uniqid(); - $db = new SQLite3('data.db'); + $db = new SQLite3(DATA_PATH . 'data.db'); $db->exec("INSERT INTO files (uuid, src) VALUES ('{$uuid}', '{$src}')"); $db->close(); @@ -285,7 +285,7 @@ function api_upload() // common func start function init() { - $db = new SQLite3('data.db'); + $db = new SQLite3(DATA_PATH . 'data.db'); // 创建表 $db->exec('CREATE TABLE IF NOT EXISTS files (id INTEGER PRIMARY KEY, uuid TEXT, src TEXT)'); $db->close(); @@ -293,6 +293,7 @@ function init() define("BASE_PATH", __DIR__ . "/../"); define("CONFIG_PATH", BASE_PATH . "/./config/"); define("PUBLIC_PATH", BASE_PATH . "/./public/"); + define("DATA_PATH", BASE_PATH . "/./data/"); empty($_SERVER['REQUEST_URI']) || $_SERVER['REQUEST_URI'] == "/" && $_SERVER['REQUEST_URI'] = "/index"; check_api();