log clear add

This commit is contained in:
2023-06-10 14:12:10 +02:00
parent d44a4b8d7e
commit 1bdd87a4ee
2 changed files with 30 additions and 11 deletions

View File

@@ -98,9 +98,9 @@ if (!empty($action) && $_SESSION["password"] == $config["admin_pwd"]){
$stmt7 = $mysqli->prepare($query);
}
else{
$query = "SELECT `ID`, `Action`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs WHERE `LinkID` = ?";
$query = "SELECT `ID`, `Action`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs WHERE `LinkID` = ? OR ContentID = ? OR Nickname = ?";
$stmt7 = $mysqli->prepare($query);
$stmt7->bind_param("s", $idcko);
$stmt7->bind_param("sss", $idcko, $idcko, $idcko);
}
$stmt7->bind_result ($rowidx, $actionx, $linkidx, $contentidx, $datetimex, $timestampx, $nicknamex, $ipx);
$stmt7->execute();
@@ -119,11 +119,20 @@ if (!empty($action) && $_SESSION["password"] == $config["admin_pwd"]){
$out = $out . "</tbody></table>";
echo $out;
}
if ($action == "deletelog" && !empty($_POST["id"])){
$stmt5 = $mysqli->prepare("DELETE FROM Logs WHERE `ID` = ?");
$stmt5->bind_param('i', $_POST["id"]);
$stmt5->execute();
$stmt5->store_result();
if ($action == "clrlog" && !empty($_POST["id"])){
$idcko = $_POST["id"];
if (empty($idcko)||$idcko == "*"){
$query = "DELETE FROM Logs";
$stmt10 = $mysqli->prepare($query);
}
else{
$query = "DELETE FROM Logs WHERE `ID` = ?";
$stmt10 = $mysqli->prepare($query);
$stmt10->bind_param("i", $idcko);
}
$stmt10->execute();
$stmt10->store_result();
}
}