update
This commit is contained in:
@@ -254,6 +254,42 @@
|
|||||||
</div>';
|
</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create sig_ex messages table
|
||||||
|
$sql = "CREATE TABLE IF NOT EXISTS sig_ex (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
signature VARCHAR(255) NOT NULL,
|
||||||
|
description VARCHAR(255) NOT NULL
|
||||||
|
)";
|
||||||
|
|
||||||
|
if ($conn->query($sql) === TRUE) {
|
||||||
|
echo '<br><div class="alert alert-success" role="alert">
|
||||||
|
Table excluded signatures created successfully!
|
||||||
|
</div>';
|
||||||
|
} else {
|
||||||
|
$success=0;
|
||||||
|
echo '<br><div class="alert alert-danger" role="alert">
|
||||||
|
Error creating table excluded signatures: ' . $conn->error .'
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create sig_in messages table
|
||||||
|
$sql = "CREATE TABLE IF NOT EXISTS sig_in (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
signature VARCHAR(255) NOT NULL,
|
||||||
|
description VARCHAR(255) NOT NULL
|
||||||
|
)";
|
||||||
|
|
||||||
|
if ($conn->query($sql) === TRUE) {
|
||||||
|
echo '<br><div class="alert alert-success" role="alert">
|
||||||
|
Table included signatures created successfully!
|
||||||
|
</div>';
|
||||||
|
} else {
|
||||||
|
$success=0;
|
||||||
|
echo '<br><div class="alert alert-danger" role="alert">
|
||||||
|
Error creating table included signatures: ' . $conn->error .'
|
||||||
|
</div>';
|
||||||
|
}
|
||||||
|
|
||||||
// Attempt to create the directory where export files will be stored later on
|
// Attempt to create the directory where export files will be stored later on
|
||||||
if (mkdir("/var/www/html/export", 0777, true)) {
|
if (mkdir("/var/www/html/export", 0777, true)) {
|
||||||
echo '<br><div class="alert alert-success" role="alert">
|
echo '<br><div class="alert alert-success" role="alert">
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ if($perms[6]!=="1"){
|
|||||||
}
|
}
|
||||||
//for the get_perms_str() function
|
//for the get_perms_str() function
|
||||||
include "perms_functions.php";
|
include "perms_functions.php";
|
||||||
|
include "../../../config.php";
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
@@ -64,7 +65,30 @@ async function update_percentage() {
|
|||||||
|
|
||||||
// Call update_percentage() every 5 seconds
|
// Call update_percentage() every 5 seconds
|
||||||
setInterval(update_percentage, 5000);
|
setInterval(update_percentage, 5000);
|
||||||
|
|
||||||
|
//update an entry
|
||||||
|
function update_textfield(id,name,itemid){
|
||||||
|
var element = document.getElementById(id);
|
||||||
|
var value = element.value;
|
||||||
|
fetch('database_settings.php?update='+name+'&value='+value+'&id='+itemid);
|
||||||
|
}
|
||||||
|
//delete an entry
|
||||||
|
async function delete_item(db,id){
|
||||||
|
await fetch('database_settings.php?delete='+id+'&db='+db);
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
//add an entry
|
||||||
|
async function add_item(db,element_id,field){
|
||||||
|
var element = document.getElementById(element_id);
|
||||||
|
var value = element.value;
|
||||||
|
await fetch('database_settings.php?add='+db+'&value='+value+'&field='+field);
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<?php
|
||||||
|
//the code to update / delete and add items:
|
||||||
|
|
||||||
|
?>
|
||||||
<div class="container mt-5">
|
<div class="container mt-5">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@@ -102,6 +126,43 @@ setInterval(update_percentage, 5000);
|
|||||||
Database update finished!
|
Database update finished!
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="excluded" style="display:none">
|
||||||
|
<!-- Table with user defined, excluded hashes -->
|
||||||
|
<?php
|
||||||
|
//load entrys from excluded db
|
||||||
|
$sql = "SELECT * FROM sig_ex";
|
||||||
|
$stmt = $conn->prepare($sql);
|
||||||
|
//$stmt->bind_param("ssssii", $loglevel, $logtext, $machine_id, $time, $offset, $page_size);
|
||||||
|
$stmt->execute();
|
||||||
|
$result = $stmt->get_result();
|
||||||
|
|
||||||
|
// Display log entries
|
||||||
|
echo '<table class="table" style="overflow-x:auto">';
|
||||||
|
echo '<thead>';
|
||||||
|
echo '<tr>';
|
||||||
|
echo '<th>Entry id</th><th>Signature</th><th>Add / Delete</th>';
|
||||||
|
echo '</tr>';
|
||||||
|
echo '</thead>';
|
||||||
|
echo '<tbody>';
|
||||||
|
echo('<tr>');
|
||||||
|
echo('<th scope="row">000</th>');
|
||||||
|
echo('<td><input type="text" id="sig_ex" class="form-control" name="name"></td>');
|
||||||
|
echo('<td><button type="button" class="btn btn-primary" onclick="add_item(\'sig_ex\',\'sig_ex\',\'signature\');">Add</button></td>');
|
||||||
|
echo('</tr>');
|
||||||
|
while($row = $result->fetch_assoc()) {
|
||||||
|
echo '<tr>';
|
||||||
|
echo("<th scope=\"row\">".$row["id"]."</th>");
|
||||||
|
echo("<td><input type=\"text\" id=\"sig_ex".$row["id"]."\" class=\"form-control\" name=\"name\" value=\"".$row["signature"]."\" oninput=\"update_textfield('sig_ex".$row["id"]."','sig_ex','".$row["id"]."');\"></td>");
|
||||||
|
echo("<td><button type=\"button\" class=\"btn btn-danger\" onclick=\"delete_item('sig_ex',".$row["id"].");\">Delete</button></td>");
|
||||||
|
echo '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</tbody>';
|
||||||
|
echo '</table>';
|
||||||
|
$conn->close();
|
||||||
|
?>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -43,31 +43,24 @@ include "perms_functions.php";
|
|||||||
<?php
|
<?php
|
||||||
//include db pw
|
//include db pw
|
||||||
include "../../../config.php";
|
include "../../../config.php";
|
||||||
|
$conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
|
||||||
|
if ($conn->connect_error) {
|
||||||
|
die("Connection failed: " . $conn->connect_error);
|
||||||
|
}
|
||||||
//delete user if requested
|
//delete user if requested
|
||||||
if(isset($_GET["delete"])){
|
if(isset($_GET["delete"])){
|
||||||
$userid=htmlspecialchars($_GET["delete"]);
|
$userid=htmlspecialchars($_GET["delete"]);
|
||||||
$conn = new mysqli($DB_SERVERNAME, $DB_USERNAME, $DB_PASSWORD, $DB_DATABASE);
|
|
||||||
if ($conn->connect_error) {
|
|
||||||
die("Connection failed: " . $conn->connect_error);
|
|
||||||
}
|
|
||||||
$sql = "DELETE FROM users WHERE id = ?";
|
$sql = "DELETE FROM users WHERE id = ?";
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
$stmt->bind_param("i", $userid);
|
$stmt->bind_param("i", $userid);
|
||||||
// Execute the statement
|
// Execute the statement
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
$conn->close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//get count of users
|
//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 user_count FROM users";
|
$sql = "SELECT count(*) AS user_count FROM users";
|
||||||
$stmt = $conn->prepare($sql);
|
$stmt = $conn->prepare($sql);
|
||||||
// Execute the statement
|
// Execute the statement
|
||||||
@@ -77,7 +70,6 @@ include "perms_functions.php";
|
|||||||
$row = $result->fetch_assoc();
|
$row = $result->fetch_assoc();
|
||||||
$num_of_users=$row["user_count"];
|
$num_of_users=$row["user_count"];
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
$conn->close();
|
|
||||||
|
|
||||||
//now list of all the users => userid, username, email, perms, delete
|
//now list of all the users => userid, username, email, perms, delete
|
||||||
// Create a connection
|
// Create a connection
|
||||||
|
|||||||
Reference in New Issue
Block a user