summaryrefslogtreecommitdiff
path: root/lib/stored_config.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stored_config.php')
-rw-r--r--lib/stored_config.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/stored_config.php b/lib/stored_config.php
new file mode 100644
index 0000000..2e7dc8a
--- /dev/null
+++ b/lib/stored_config.php
@@ -0,0 +1,14 @@
+<?php
+
+function scGet(string $key) {
+ $db = DB();
+ $q = $db->query("SELECT value FROM config WHERE name=?", $key);
+ if (!$db->numRows($q))
+ return null;
+ return $db->result($q);
+}
+
+function scSet($key, $value) {
+ $db = DB();
+ return $db->query("REPLACE INTO config (name, value) VALUES (?, ?)", $key, $value);
+}