update
This commit is contained in:
@@ -4,21 +4,22 @@
|
|||||||
|
|
||||||
//add the entry to the log db
|
//add the entry to the log db
|
||||||
//this page has no gui, it may return ok or error
|
//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");
|
echo("syn_err");
|
||||||
else{
|
else{
|
||||||
$loglevel=htmlspecialchars($_GET["loglevel"]);
|
$loglevel=htmlspecialchars($_GET["loglevel"]);
|
||||||
$logtext=htmlspecialchars($_GET["logtext"]);
|
$logtext=htmlspecialchars($_GET["logtext"]);
|
||||||
$machine_id=htmlspecialchars($_GET["machine_id"]);
|
$machine_id=htmlspecialchars($_GET["machine_id"]);
|
||||||
|
$time=htmlspecialchars($_GET["time"]);
|
||||||
//include db pw
|
//include db pw
|
||||||
include "../../../config.php";
|
include "../../../config.php";
|
||||||
$conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
|
$conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
|
||||||
if ($conn->connect_error) {
|
if ($conn->connect_error) {
|
||||||
die("conn_err");
|
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 = $conn->prepare($sql);
|
||||||
$stmt->bind_param("sss", $loglevel,$machine_id,$logtext);
|
$stmt->bind_param("ssss", $loglevel,$machine_id,$logtext,$time);
|
||||||
// Execute the statement
|
// Execute the statement
|
||||||
if(!$stmt->execute())
|
if(!$stmt->execute())
|
||||||
echo("wrt_err");
|
echo("wrt_err");
|
||||||
|
|||||||
@@ -82,7 +82,8 @@
|
|||||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
logtext VARCHAR(255) NOT NULL,
|
logtext VARCHAR(255) NOT NULL,
|
||||||
loglevel 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) {
|
if ($conn->query($sql) === TRUE) {
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ if($perms[2]!=="1"){
|
|||||||
echo('<table class="table">');
|
echo('<table class="table">');
|
||||||
echo('<thead>');
|
echo('<thead>');
|
||||||
echo('<tr>');
|
echo('<tr>');
|
||||||
echo('<th>Entry id</th><th>Loglevel</th><th>Logtext</th><th>Machine id</th><th>Delete entry</th>');
|
echo('<th>Entry id</th><th>Loglevel</th><th>Logtext</th><th>Machine id</th><th>Time & date</th><th>Delete entry</th>');
|
||||||
echo('</tr>');
|
echo('</tr>');
|
||||||
echo('</thead>');
|
echo('</thead>');
|
||||||
echo('<tbody>');
|
echo('<tbody>');
|
||||||
@@ -118,12 +118,18 @@ if($perms[2]!=="1"){
|
|||||||
$machine_id_ss=$_GET["machine_id"];
|
$machine_id_ss=$_GET["machine_id"];
|
||||||
else
|
else
|
||||||
$machine_id_ss="Machine id";
|
$machine_id_ss="Machine id";
|
||||||
|
|
||||||
|
if(isset($_GET["time"]))
|
||||||
|
$time_ss=$_GET["time"];
|
||||||
|
else
|
||||||
|
$time_ss="Date & time";
|
||||||
echo('<tr>');
|
echo('<tr>');
|
||||||
echo('<form action="view_log.php" method="get">');
|
echo('<form action="view_log.php" method="get">');
|
||||||
echo('<td><button type="submit" class="btn btn-primary btn-block">Filter</button></td>');
|
echo('<td><button type="submit" class="btn btn-primary btn-block">Filter</button></td>');
|
||||||
echo('<td><input type="text" class="form-control" name="loglevel" placeholder="'.$loglevel_ss.'"></td>');
|
echo('<td><input type="text" class="form-control" name="loglevel" placeholder="'.$loglevel_ss.'"></td>');
|
||||||
echo('<td><input type="text" class="form-control" name="logtext" placeholder="'.$logtext_ss.'"></td>');
|
echo('<td><input type="text" class="form-control" name="logtext" placeholder="'.$logtext_ss.'"></td>');
|
||||||
echo('<td><input type="text" class="form-control" name="machine_id" placeholder="'.$machine_id_ss.'"></td>');
|
echo('<td><input type="text" class="form-control" name="machine_id" placeholder="'.$machine_id_ss.'"></td>');
|
||||||
|
echo('<td><input type="text" class="form-control" name="time" placeholder="'.$time_ss.'"></td>');
|
||||||
echo('<td>---</td>');
|
echo('<td>---</td>');
|
||||||
echo('</form>');
|
echo('</form>');
|
||||||
echo('</tr>');
|
echo('</tr>');
|
||||||
@@ -140,6 +146,7 @@ if($perms[2]!=="1"){
|
|||||||
$loglevel=$row["loglevel"];
|
$loglevel=$row["loglevel"];
|
||||||
$logtext=$row["logtext"];
|
$logtext=$row["logtext"];
|
||||||
$machine_id=$row["machine_id"];
|
$machine_id=$row["machine_id"];
|
||||||
|
$time=$row["time"];
|
||||||
$show=true;
|
$show=true;
|
||||||
//evaluate filter, decide if entry should be shown or not
|
//evaluate filter, decide if entry should be shown or not
|
||||||
if(isset($_GET["loglevel"]) && $_GET["loglevel"]!==""){
|
if(isset($_GET["loglevel"]) && $_GET["loglevel"]!==""){
|
||||||
@@ -154,6 +161,10 @@ if($perms[2]!=="1"){
|
|||||||
if(stripos($machine_id,$_GET["machine_id"])===false){
|
if(stripos($machine_id,$_GET["machine_id"])===false){
|
||||||
$show=false;
|
$show=false;
|
||||||
}
|
}
|
||||||
|
}if(isset($_GET["time"]) && $_GET["time"]!==""){
|
||||||
|
if(stripos($time,$_GET["time"])===false){
|
||||||
|
$show=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if($show==true){
|
if($show==true){
|
||||||
echo('<tr>');
|
echo('<tr>');
|
||||||
@@ -161,6 +172,7 @@ if($perms[2]!=="1"){
|
|||||||
echo('<td>'.$loglevel.'</td>');
|
echo('<td>'.$loglevel.'</td>');
|
||||||
echo('<td>'.$logtext.'</td>');
|
echo('<td>'.$logtext.'</td>');
|
||||||
echo('<td>'.$machine_id.'</td>');
|
echo('<td>'.$machine_id.'</td>');
|
||||||
|
echo('<td>'.$time.'</td>');
|
||||||
echo('<td><a href="view_log.php?delete='.$last_id.'">delete</a></td>');
|
echo('<td><a href="view_log.php?delete='.$last_id.'">delete</a></td>');
|
||||||
echo('</tr>');
|
echo('</tr>');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user