diff options
Diffstat (limited to 'html/db.php')
-rw-r--r-- | html/db.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/html/db.php b/html/db.php index 9830c5b..fee5ef6 100644 --- a/html/db.php +++ b/html/db.php @@ -36,9 +36,12 @@ class MyDB extends SQLite3 { die(); return $result['state_id']; } - function add_key($comment) { + function add_key($comment, $key = NULL) { $stm = $this -> prepare('INSERT INTO keys (key, comment) VALUES (:key, :comment)'); - $stm -> bindValue('key', bin2hex(random_bytes(64))); + if ($key == NULL) + $stm -> bindValue('key', bin2hex(random_bytes(64))); + else + $stm -> bindValue('key', $key); $stm -> bindValue('comment', $comment); $stm -> execute(); $key_id = $this -> lastInsertRowID(); |