Update export_log.php

This commit is contained in:
jakani24
2024-01-21 17:40:04 +01:00
parent 21a012a1a2
commit 68a050fc7e

View File

@@ -66,6 +66,8 @@ if($perms[2]!=="1"){
if ($conn->connect_error) { if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error); die("Connection failed: " . $conn->connect_error);
} }
$export_file = fopen("/var/www/html/export/cyberhex_log_export.vsc", 'w');
fwrite($export_file,"id;loglevel;logtext;machine_id;time\r\n");
while($num_of_log_entrys!=0){ while($num_of_log_entrys!=0){
$sql = "SELECT * FROM log where id > $last_id"; $sql = "SELECT * FROM log where id > $last_id";
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
@@ -99,13 +101,11 @@ if($perms[2]!=="1"){
} }
} }
if($show==true){ if($show==true){
echo('<tr>'); fwrite($file,$last_id.";");
echo('<td>'.$last_id.'</td>'); fwrite($file,$loglevel.";");
echo('<td>'.$loglevel.'</td>'); fwrite($file,$logtext.";");
echo('<td>'.$logtext.'</td>'); fwrite($file,$machine_id.";");
echo('<td>'.$machine_id.'</td>'); fwrite($file,$time."\r\n");
echo('<td>'.$time.'</td>');
echo('</tr>');
} }
$stmt->close(); $stmt->close();
$num_of_log_entrys--; $num_of_log_entrys--;