edit api.php

This commit is contained in:
Bruno Rybársky 2023-06-12 16:13:17 +02:00
parent 69b1e99cfb
commit 2f75cc78a0
No known key found for this signature in database
GPG Key ID: DFE2C061EF985CD4

@ -16,7 +16,7 @@ if (!empty($action) && $_SESSION["password"] == $config["admin_pwd"]){
}
if ($action == "getlinks"){
$stmt1 = $mysqli->prepare("SELECT `LinkID`, `ContentID`, `Nickname` FROM Links");
$stmt1 = $mysqli->prepare("SELECT `LinkID`, `ContentID`, `Nickname` FROM Links;");
$stmt1->bind_result($linkid, $contentid, $nickname);
$stmt1->execute();
$stmt1->store_result();
@ -33,7 +33,7 @@ if (!empty($action) && $_SESSION["password"] == $config["admin_pwd"]){
}
if ($action == "deletelink" && !empty($_POST["id"])){
$stmt2 = $mysqli->prepare("DELETE FROM Links WHERE `LinkID` = ?");
$stmt2 = $mysqli->prepare("DELETE FROM Links WHERE `LinkID` = ?;");
$stmt2->bind_param('s', $_POST["id"]);
$stmt2->execute();
$stmt2->store_result();
@ -47,7 +47,7 @@ if (!empty($action) && $_SESSION["password"] == $config["admin_pwd"]){
}
if ($action == "getcontent"){
$stmt4 = $mysqli->prepare("SELECT `ContentID`, `Content` FROM Content");
$stmt4 = $mysqli->prepare("SELECT `ContentID`, `Content` FROM Content;");
$stmt4->bind_result ($contentid, $content);
$stmt4->execute();
$stmt4->store_result();
@ -64,7 +64,7 @@ if (!empty($action) && $_SESSION["password"] == $config["admin_pwd"]){
}
if ($action == "deletecontent" && !empty($_POST["id"])){
$stmt5 = $mysqli->prepare("DELETE FROM Content WHERE `ContentID` = ?");
$stmt5 = $mysqli->prepare("DELETE FROM Content WHERE `ContentID` = ?;");
$stmt5->bind_param('s', $_POST["id"]);
$stmt5->execute();
$stmt5->store_result();
@ -94,11 +94,11 @@ if (!empty($action) && $_SESSION["password"] == $config["admin_pwd"]){
if ($action == "getlog"){
$idcko = $_POST["id"];
if (empty($idcko)||$idcko == "*"){
$query = "SELECT `ID`, `Action`, `ExtraInfo`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs";
$query = "SELECT `ID`, `Action`, `ExtraInfo`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs ORDER BY Timestamp DSC;";
$stmt7 = $mysqli->prepare($query);
}
else{
$query = "SELECT `ID`, `Action`, `ExtraInfo`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs WHERE `LinkID` = ? OR `ContentID` = ? OR `Nickname` = ? OR `IP` = ? OR `ExtraInfo` = ? OR `Action` = ? OR `Datetime` = ? ";
$query = "SELECT `ID`, `Action`, `ExtraInfo`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs WHERE `LinkID` = ? OR `ContentID` = ? OR `Nickname` = ? OR `IP` = ? OR `ExtraInfo` = ? OR `Action` = ? OR `Datetime` = ? ORDER BY Timestamp DSC;";
$stmt7 = $mysqli->prepare($query);
$stmt7->bind_param("sssssss", $idcko, $idcko, $idcko, $idcko, $idcko, $idcko, $idcko);
}
@ -124,11 +124,11 @@ if (!empty($action) && $_SESSION["password"] == $config["admin_pwd"]){
if ($action == "clrlog" && !empty($_POST["id"])){
$idcko = $_POST["id"];
if (empty($idcko)||$idcko == "*"){
$query = "DELETE FROM Logs";
$query = "DELETE FROM Logs;";
$stmt10 = $mysqli->prepare($query);
}
else{
$query = "DELETE FROM Logs WHERE `ID` = ?";
$query = "DELETE FROM Logs WHERE `ID` = ?;";
$stmt10 = $mysqli->prepare($query);
$stmt10->bind_param("i", $idcko);
}