From e40fc5c96c21889addf285fd33d6f52b0c33654d Mon Sep 17 00:00:00 2001 From: jakani24 Date: Sat, 17 Feb 2024 10:55:12 +0100 Subject: [PATCH] Update add_client.php --- .../system/secure_zone/php/add_client.php | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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 db19a97..19449ed 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 @@ -46,7 +46,7 @@ include "../../../config.php";
- +
@@ -96,6 +96,32 @@ include "../../../config.php"; $stmt->bind_param("ss", $machineid, $apikey); $stmt->execute(); $stmt->close(); + + //get the address of this server + $sql = "SELECT * FROM settings WHERE name = 'setting_server_server_url'"; + $stmt = $conn->prepare($sql); + // Execute the statement + $stmt->execute(); + // Get the result + $result = $stmt->get_result(); + $row = $result->fetch_assoc(); + if($row!==null){ + $this_server=$row["value"]; + } + $stmt -> close(); + //create the files and download them + file $fp; + $fp=fopen("/var/www/html/setup.txt"); + fwrite($fp,"$this_server"); + fclose($fp); + $fp=fopen("/var/www/html/secrets.txt"); + fwrite($fp,"machineid $machineid\n"); + fwrite($fp,"cert $cert\n"); + fwrite($fp,"apikey $apikey\n"); + fclose($fp); + echo("Download config file1"); + echo("Download config file2"); + echo("Download installer"); } ?>