added php code to get settings from database to react state

add onchange events to change state on field change
This commit is contained in:
2020-07-10 01:18:23 +02:00
parent 75ae0d7d8b
commit 133851fe0d
2 changed files with 52 additions and 12 deletions

26
api/Settings.php Normal file
View File

@ -0,0 +1,26 @@
<?php
require 'Database.php';
$conn = Database::getInstance()->getConnection();
if (isset($_POST['action'])) {
$action = $_POST['action'];
switch ($action) {
case "loadGeneralSettings":
$query = "SELECT * from settings";
$result = $conn->query($query);
if ($result->num_rows > 1) {
// todo throw error
}
$r = mysqli_fetch_assoc($result);
if ($r['password'] != "-1") {
$r['passwordEnabled'] = true;
} else {
$r['passwordEnabled'] = true;
}
echo json_encode($r);
break;
}
}