ID | Content ID | Nickname | Button |
";
foreach($stranky as $idx => $arr) {
$id = htmlspecialchars($idx);
$nickname = htmlspecialchars($arr["nickname"]);
$contentid = htmlspecialchars($arr["contentid"]);
$out = $out . "$id | $contentid | $nickname | |
";
}
$out = $out . " | | | |
";
$out = $out . "";
echo $out;
}
}
if ($action == "delete" && !empty($_POST["id"])){
if ($_POST["password"] == $config["admin_pwd"]){
$stranky = json_decode(file_get_contents("../data/pageindex.json"), true);
unset($stranky[$_POST["id"]]);
file_put_contents("../data/pageindex.json", json_encode($stranky, JSON_PRETTY_PRINT));
}
}
if ($action == "set" && !empty($_POST["id"]) && !empty($_POST["contentid"]) && !empty($_POST["nickname"])){
if ($_POST["password"] == $config["admin_pwd"]){
$stranky = json_decode(file_get_contents("../data/pageindex.json"), true);
$tmp = array("contentid"=>$_POST["contentid"], "nickname"=>$_POST["nickname"]);
$stranky[$_POST["id"]] = $tmp;
file_put_contents("../data/pageindex.json", json_encode($stranky, JSON_PRETTY_PRINT));
}
}
if ($action == "getcontent"){
if ($_POST["password"] == $config["admin_pwd"]){
$contents = json_decode(file_get_contents("../data/contents.json"), true);
$out = "";
echo $out;
}
}
if ($action == "deletecontent" && !empty($_POST["id"])){
if ($_POST["password"] == $config["admin_pwd"]){
$contents = json_decode(file_get_contents("../data/contents.json"), true);
unset($contents[$_POST["id"]]);
file_put_contents("../data/contents.json", json_encode($contents, JSON_PRETTY_PRINT));
}
}
if ($action == "setcontent" && !empty($_POST["id"]) && !empty($_POST["content"])){
if ($_POST["password"] == $config["admin_pwd"]){
$contents = json_decode(file_get_contents("../data/contents.json"), true);
$contents[$_POST["id"]] = $_POST["content"];
file_put_contents("../data/contents.json", json_encode($contents, JSON_PRETTY_PRINT));
}
}
if ($action == "getlog"&& !empty($_POST["id"])){
if ($_POST["password"] == $config["admin_pwd"]){
$logy = json_decode(file_get_contents("../data/logs.json"), true)[$_POST["id"]];
$out = "Action | Date and Time | Nickname | Link | IP |
";
foreach($logy as $arr) {
$action = htmlspecialchars($arr["action"]);
$link = htmlspecialchars($arr["link"]);
$nickname = htmlspecialchars($arr["nickname"]);
$ip = htmlspecialchars($arr["ip"]);
$datetime = htmlspecialchars($arr["datetime"]);
$out = $out . "$action | $datetime | $nickname | $link | $ip |
";
}
$out = $out . "
";
echo $out;
}
}
}
?>