From 3d2b5f03e1418acdb3730fca9ab056f87c5861f6 Mon Sep 17 00:00:00 2001 From: jakani24 Date: Sat, 17 Feb 2024 10:39:44 +0100 Subject: [PATCH] Update add_client.php --- .../system/secure_zone/php/add_client.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/server/cyberhex-code/system/secure_zone/php/add_client.php b/src/server/cyberhex-code/system/secure_zone/php/add_client.php index a0da1ad..db19a97 100644 --- a/src/server/cyberhex-code/system/secure_zone/php/add_client.php +++ b/src/server/cyberhex-code/system/secure_zone/php/add_client.php @@ -88,9 +88,14 @@ include "../../../config.php"; // Convert the random bytes to hexadecimal $apikey = bin2hex($random_bytes); - echo($cert); - echo("
"); - echo($apikey); + $stmt = $conn->prepare("INSERT INTO secrets (machine_id, cert) VALUES (?, ?)"); + $stmt->bind_param("ss", $machineid, $cert); + $stmt->execute(); + $stmt->close(); + $stmt = $conn->prepare("INSERT INTO api (machine_id, apikey) VALUES (?, ?)"); + $stmt->bind_param("ss", $machineid, $apikey); + $stmt->execute(); + $stmt->close(); } ?>