prepare("SELECT `LinkID`, `ContentID`, `Nickname` FROM Links");
$stmt1->bind_result($linkid, $contentid, $nickname);
$stmt1->execute();
$stmt1->store_result();
$out = "
";
echo $out;
}
if ($action == "delete" && !empty($_POST["id"])){
$stmt2 = $mysqli->prepare("DELETE FROM Links WHERE `LinkID` = ?");
$stmt2->bind_param('s', $_POST["id"]);
$stmt2->execute();
$stmt2->store_result();
}
if ($action == "set" && !empty($_POST["id"]) && !empty($_POST["contentid"]) && !empty($_POST["nickname"])){
$stmt3 = $mysqli->prepare("INSERT INTO Links (`LinkID`, `ContentID`, `Nickname`) VALUES (?, ?, ?);");
$stmt3->bind_param('sss', $_POST["id"], $_POST["contentid"], $_POST["nickname"]);
$stmt3->execute();
$stmt3->store_result();
}
if ($action == "getcontent"){
$stmt4 = $mysqli->prepare("SELECT `ContentID`, `Content` FROM Content");
$stmt4->bind_result ($contentid, $content);
$stmt4->execute();
$stmt4->store_result();
$out = "";
echo $out;
}
if ($action == "deletecontent" && !empty($_POST["id"])){
$stmt5 = $mysqli->prepare("DELETE FROM Content WHERE `ContentID` = ?");
$stmt5->bind_param('s', $_POST["id"]);
$stmt5->execute();
$stmt5->store_result();
}
if ($action == "setcontent" && !empty($_POST["id"]) && !empty($_POST["content"])){
$stmt6 = $mysqli->prepare("INSERT INTO Content (`ContentID`, `Content`) VALUES (?, ?);");
$stmt6->bind_param('ss', $_POST["id"], $_POST["content"]);
$stmt6->execute();
$stmt6->store_result();
}
if ($action == "getlog"){
$idcko = $_POST["id"];
if (empty($idcko)||$idcko == "*"){
$query = "SELECT `ID`, `Action`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs";
$stmt7 = $mysqli->prepare($query);
}
else{
$query = "SELECT `ID`, `Action`, `LinkID`, `ContentID`, `Datetime`, `Timestamp`, `Nickname`, `IP` FROM Logs WHERE `LinkID` = ?";
$stmt7 = $mysqli->prepare($query);
$stmt7->bind_param("s", $idcko);
}
$stmt7->bind_result ($rowidx, $actionx, $linkidx, $contentidx, $datetimex, $timestampx, $nicknamex, $ipx);
$stmt7->execute();
$stmt7->store_result();
$out = "Action | Date and Time | Nickname | Link | Content | IP | Button |
";
while ($stmt7->fetch()) {
$action = htmlspecialchars($actionx);
$link = htmlspecialchars($linkidx);
$content = htmlspecialchars($contentidx);
$nickname = htmlspecialchars($nicknamex);
$ip = htmlspecialchars($ipx);
$rowid = htmlspecialchars($rowidx);
$datetime = htmlspecialchars($datetimex);
$out = $out . "$action | $datetime | $nickname | $link | $content | $ip | |
";
}
$out = $out . "
";
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();
}
}
else{
echo "ERROR";
}
?>