+
+ 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('| Machineid | Location | IP-Address | Delete user | ');
+ 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('| '.$machine_id.' | ');
+ echo(''.$machine_location.' | ');
+ echo(''.$machine_ip.' | ');
+ echo('delete | ');
+ echo('
');
+ $stmt->close();
+ $num_of_users--;
+ }
+ echo('');
+ echo('
');
+ $conn->close();
+ ?>
+