diff --git a/admin/api.php b/admin/api.php
index b40de78..7da6c79 100644
--- a/admin/api.php
+++ b/admin/api.php
@@ -47,17 +47,22 @@ if (!empty($action) && $_SESSION["password"] == $config["admin_pwd"]){
}
if ($action == "getcontent"){
- $stmt4 = $mysqli->prepare("SELECT `ContentID`, `Content` FROM Content");
- $stmt4->bind_result ($contentid, $content);
+ $stmt4 = $mysqli->prepare("SELECT `ContentID`, `Type`, `Content` FROM Content");
+ $stmt4->bind_result ($contentid, $type, $content);
$stmt4->execute();
$stmt4->store_result();
$out = "
";
echo $out;
}
@@ -70,8 +75,14 @@ if (!empty($action) && $_SESSION["password"] == $config["admin_pwd"]){
}
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 = $mysqli->prepare("INSERT INTO Content (`ContentID`, `Type`, `Content`) VALUES (?, ?, ?);");
+ if (!empty($_POST["type"])){
+ $decoded = base64_decode($_POST["content"]);
+ $stmt6->bind_param('sss', $_POST["id"], $_POST["type"], $decoded);
+ }
+ else{
+ $stmt6->bind_param('sss', $_POST["id"], "", $_POST["content"]);
+ }
$stmt6->execute();
$stmt6->store_result();
}
diff --git a/admin/index.html b/admin/index.html
index 0eeb038..8b1bdbb 100644
--- a/admin/index.html
+++ b/admin/index.html
@@ -33,12 +33,15 @@
function justaddc(){
let id = $("#addidc").val();
let content = $("#addcontentc").val();
+ let type = "normal";
+ type = $("#addtypec").val();
$.post("api.php",
{
action: "setcontent",
password: password,
id: id,
content: content,
+ type: type,
}, function( data ) {
getcontents();
});
diff --git a/index.php b/index.php
index 73cf938..f990bff 100644
--- a/index.php
+++ b/index.php
@@ -19,9 +19,9 @@ if (!empty($idcko)){
die("Nonexistent link");
}
while ($stmt1->fetch()) {
- $stmt2 = $mysqli->prepare("SELECT `Content` FROM Content WHERE `ContentID` = ?");
+ $stmt2 = $mysqli->prepare("SELECT `Type`, `Content` FROM Content WHERE `ContentID` = ?");
$stmt2->bind_param("s", $contentid);
- $stmt2->bind_result ($content);
+ $stmt2->bind_result ($type, $content);
$stmt2->execute();
$stmt2->store_result();
if ($stmt2->num_rows() < 1) {
@@ -33,6 +33,10 @@ if (!empty($idcko)){
$stmt3->bind_param('ssssss', $action, $idcko, $contentid, $curdate, $nickname, $ipcka);
$stmt3->execute();
$stmt3->store_result();
+ if ($type == 1){
+
+ }
+ header("Content-Type: $type");
echo $content;
}