diff --git a/src/server/cyberhex-code/api/php/log/add_entry.php b/src/server/cyberhex-code/api/php/log/add_entry.php index 8604c31..f11907a 100644 --- a/src/server/cyberhex-code/api/php/log/add_entry.php +++ b/src/server/cyberhex-code/api/php/log/add_entry.php @@ -4,21 +4,22 @@ //add the entry to the log db //this page has no gui, it may return ok or error -if(!isset($_GET["loglevel"]) or !isset($_GET["logtext"]) or !isset($_GET["machine_id"])) +if(!isset($_GET["loglevel"]) or !isset($_GET["logtext"]) or !isset($_GET["machine_id"]) or !isset($_GET["time"])) echo("syn_err"); else{ $loglevel=htmlspecialchars($_GET["loglevel"]); $logtext=htmlspecialchars($_GET["logtext"]); $machine_id=htmlspecialchars($_GET["machine_id"]); + $time=htmlspecialchars($_GET["time"]); //include db pw include "../../../config.php"; $conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE); if ($conn->connect_error) { die("conn_err"); } - $sql = "INSERT INTO log (loglevel,machine_id,logtext) VALUES (?,?,?);"; + $sql = "INSERT INTO log (loglevel,machine_id,logtext,time) VALUES (?,?,?,?);"; $stmt = $conn->prepare($sql); - $stmt->bind_param("sss", $loglevel,$machine_id,$logtext); + $stmt->bind_param("ssss", $loglevel,$machine_id,$logtext,$time); // Execute the statement if(!$stmt->execute()) echo("wrt_err"); diff --git a/src/server/cyberhex-code/install/create_db.php b/src/server/cyberhex-code/install/create_db.php index 1817d9f..bd65243 100644 --- a/src/server/cyberhex-code/install/create_db.php +++ b/src/server/cyberhex-code/install/create_db.php @@ -82,7 +82,8 @@ id INT AUTO_INCREMENT PRIMARY KEY, logtext VARCHAR(255) NOT NULL, loglevel VARCHAR(255) NOT NULL, - machine_id VARCHAR(255) + machine_id VARCHAR(255), + time VARCHAR(255) )"; if ($conn->query($sql) === TRUE) { diff --git a/src/server/cyberhex-code/system/secure_zone/php/view_log.php b/src/server/cyberhex-code/system/secure_zone/php/view_log.php index 3beb61f..7a76561 100644 --- a/src/server/cyberhex-code/system/secure_zone/php/view_log.php +++ b/src/server/cyberhex-code/system/secure_zone/php/view_log.php @@ -98,7 +98,7 @@ if($perms[2]!=="1"){ echo(''); echo(''); echo(''); - echo(''); + echo(''); echo(''); echo(''); echo(''); @@ -118,12 +118,18 @@ if($perms[2]!=="1"){ $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(''); @@ -140,6 +146,7 @@ if($perms[2]!=="1"){ $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"]!==""){ @@ -154,6 +161,10 @@ if($perms[2]!=="1"){ 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(''); @@ -161,6 +172,7 @@ if($perms[2]!=="1"){ echo(''); echo(''); echo(''); + echo(''); echo(''); echo(''); }
Entry idLoglevelLogtextMachine idDelete entryEntry idLoglevelLogtextMachine idTime & dateDelete entry
---
'.$loglevel.''.$logtext.''.$machine_id.''.$time.'delete