diff --git a/src/server/cyberhex-code/system/secure_zone/php/export_log.php b/src/server/cyberhex-code/system/secure_zone/php/export_log.php new file mode 100644 index 0000000..b4db339 --- /dev/null +++ b/src/server/cyberhex-code/system/secure_zone/php/export_log.php @@ -0,0 +1,187 @@ + + + + + + + + Change Password + + + +
+
+
+
+
+

Export log

+
+
+

You can use filters before you export the log. The filter preview is below.

+ + connect_error) { + die("Connection failed: " . $conn->connect_error); + } + $sql = "DELETE FROM log WHERE id = ?"; + $stmt = $conn->prepare($sql); + $stmt->bind_param("i", $id); + // Execute the statement + $stmt->execute(); + $stmt->close(); + $conn->close(); + echo ''; + } + + //get count of log entrys + // 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 log_count FROM log"; + $stmt = $conn->prepare($sql); + // Execute the statement + $stmt->execute(); + // Get the result + $result = $stmt->get_result(); + $row = $result->fetch_assoc(); + $num_of_log_entrys=$row["log_count"]; + $stmt->close(); + $conn->close(); + + //list out log => id, loglevel, logtext, machine_id + // 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(''); + + //put filter options here + if(isset($_GET["loglevel"])) + $loglevel_ss=$_GET["loglevel"]; //put the loglevel search string to that and afterwards show it in the filter optionss. so a user sees what he has filtered for + else + $loglevel_ss="Loglevel"; + + if(isset($_GET["logtext"])) + $logtext_ss=$_GET["logtext"]; + else + $logtext_ss="Logtext"; + + if(isset($_GET["machine_id"])) + $machine_id_ss=$_GET["machine_id"]; + else + $machine_id_ss="Machine id"; + + if(isset($_GET["time"])) + $time_ss=$_GET["time"]; + else + $time_ss="Date & time"; + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + + while($num_of_log_entrys!=0){ + $sql = "SELECT * FROM log 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"]; + $loglevel=$row["loglevel"]; + $logtext=$row["logtext"]; + $machine_id=$row["machine_id"]; + $time=$row["time"]; + $show=true; + //evaluate filter, decide if entry should be shown or not + if(isset($_GET["loglevel"]) && $_GET["loglevel"]!==""){ + if(stripos($loglevel,$_GET["loglevel"])===false){ + $show=false; + } + }if(isset($_GET["logtext"]) && $_GET["logtext"]!==""){ + if(stripos($logtext,$_GET["logtext"])===false){ + $show=false; + } + }if(isset($_GET["machine_id"]) && $_GET["machine_id"]!==""){ + if(stripos($machine_id,$_GET["machine_id"])===false){ + $show=false; + } + }if(isset($_GET["time"]) && $_GET["time"]!==""){ + if(stripos($time,$_GET["time"])===false){ + $show=false; + } + } + if($show==true){ + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + echo(''); + } + $stmt->close(); + $num_of_log_entrys--; + } + echo(''); + echo('
Entry idLoglevelLogtextMachine idTime & dateDelete entry
---
'.$last_id.''.$loglevel.''.$logtext.''.$machine_id.''.$time.'delete
'); + $conn->close(); + ?> +
+
+
+
+
+ +