summaryrefslogtreecommitdiff
path: root/html/maintenance.php
diff options
context:
space:
mode:
Diffstat (limited to 'html/maintenance.php')
-rw-r--r--html/maintenance.php12
1 files changed, 2 insertions, 10 deletions
diff --git a/html/maintenance.php b/html/maintenance.php
index a60ff2c..677d750 100644
--- a/html/maintenance.php
+++ b/html/maintenance.php
@@ -45,11 +45,7 @@ if (array_key_exists('machine',$_GET)) {
$machine_id = $db -> lastInsertRowID();
$stm -> close();
- $stm = $db -> prepare('INSERT INTO keys (key) VALUES (:key)');
- $stm -> bindValue('key', bin2hex(random_bytes(64)));
- $stm -> execute();
- $key_id = $db -> lastInsertRowID();
- $stm -> close();
+ $key_id = $db -> add_key();
$stm = $db -> prepare(
'INSERT INTO "values" (machine_id, state_id) VALUES (:machine, :state)'
@@ -106,11 +102,7 @@ if (array_key_exists('ddns', $_GET)) {
}
}
- $stm = $db -> prepare('INSERT INTO keys (key) VALUES (:key)');
- $stm -> bindValue('key', bin2hex(random_bytes(64)));
- $stm -> execute();
- $key_id = $db -> lastInsertRowID();
- $stm -> close();
+ $key_id = $db -> add_key();
$stm = $db -> prepare('INSERT INTO permissions(key_id, value_id) VALUES (:key_id, :value_id)');
$stm -> bindValue('key_id', $key_id);