From d6f938f7243386dc2808653b114c59bda4196b1e Mon Sep 17 00:00:00 2001 From: jakani24 Date: Sat, 9 Mar 2024 16:54:06 +0100 Subject: [PATCH] Create client_list.php --- .../system/secure_zone/php/client_list.php | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 src/server/cyberhex-code/system/secure_zone/php/client_list.php diff --git a/src/server/cyberhex-code/system/secure_zone/php/client_list.php b/src/server/cyberhex-code/system/secure_zone/php/client_list.php new file mode 100644 index 0000000..9ebed83 --- /dev/null +++ b/src/server/cyberhex-code/system/secure_zone/php/client_list.php @@ -0,0 +1,130 @@ + + + + + + + + Change Password + + + +
+
+
+
+
+

Client list

+
+
+ + connect_error) { + die("Connection failed: " . $conn->connect_error); + } + $sql = "DELETE FROM machines WHERE id = ?"; + $stmt = $conn->prepare($sql); + $stmt->bind_param("i", $userid); + // Execute the statement + $stmt->execute(); + $stmt->close(); + $conn->close(); + } + + + //get count of users + // Create a connection + $conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE); + + // Check the connection + if ($conn->connect_error) { + die("Connection failed: " . $conn->connect_error); + } + $sql = "SELECT count(*) AS machine_count FROM machines"; + $stmt = $conn->prepare($sql); + // Execute the statement + $stmt->execute(); + // Get the result + $result = $stmt->get_result(); + $row = $result->fetch_assoc(); + $num_of_machines=$row["machine_count"]; + $stmt->close(); + $conn->close(); + + //now list of all the users => userid, username, email, perms, delete + // Create a connection + $conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE); + + // Check the connection + if ($conn->connect_error) { + die("Connection failed: " . $conn->connect_error); + } + $last_id=-1; + //create the table header + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + while($num_of_machines!=0){ + $sql = "SELECT * FROM machines where id > $last_id"; + $stmt = $conn->prepare($sql); + // Execute the statement + $stmt->execute(); + // Get the result + $result = $stmt->get_result(); + $row = $result->fetch_assoc(); + $last_id=$row["id"]; + $machine_id=$row["machine_id"]; + $machine_location=$row["machine_location"]; + $machine_ip=$row["machine_ip"]; + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + $stmt->close(); + $num_of_users--; + } + echo(''); + echo('
MachineidLocationIP-AddressDelete user
'.$machine_id.''.$machine_location.''.$machine_ip.'delete
'); + $conn->close(); + ?> +
+
+
+
+
+ +