add mime type
This commit is contained in:
@@ -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 = "<table><tbody><tr><th>Content ID</th><th>Content</th><th>Button</th></tr>";
|
||||
while ($stmt4->fetch()) {
|
||||
$id = htmlspecialchars($contentid);
|
||||
$content = htmlspecialchars($content);
|
||||
if(empty($type)){
|
||||
$content = htmlspecialchars($content);
|
||||
}
|
||||
else{
|
||||
$content = "Binary data";
|
||||
}
|
||||
$out = $out . "<tr><td>$id</td><td>$content</td><td><button onclick=\"delcthis('$id')\">Delete</button></td></tr>";
|
||||
}
|
||||
$out = $out . "<tr><td><input id=\"addidc\" placeholder=\"Content ID\"></td><td><textarea id=\"addcontentc\" placeholder=\"Content\"></textarea></td><td><button id=\"contentadder\" onclick=\"justaddc()\">Add</button></td></tr>";
|
||||
$out = $out . "<tr><td><input id=\"addidc\" placeholder=\"Content ID\"></td><td><textarea id=\"addcontentc\" placeholder=\"Content\"></textarea></td><td><input id=\"addtypec\" placeholder=\"MIME Type(when set the data must be Base64)\"></td></td><td><button id=\"contentadder\" onclick=\"justaddc()\">Add</button></td></tr>";
|
||||
$out = $out . "</tbody></table>";
|
||||
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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user