Add article creation frontend
This commit is contained in:
parent
c478da8088
commit
f9cf2eab8f
@ -184,8 +184,8 @@ async function submitarticle(){
|
|||||||
let articleBodyElement = document.getElementById("articlebodyinput");
|
let articleBodyElement = document.getElementById("articlebodyinput");
|
||||||
await doAction("/newsarticle", {
|
await doAction("/newsarticle", {
|
||||||
action: "addNewsArticle",
|
action: "addNewsArticle",
|
||||||
title: articleTitleElement,
|
title: articleTitleElement.value,
|
||||||
body: articleBodyElement
|
body: articleBodyElement.value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ function addNewsArticle($title="Nazov", $body="Obsah") :array
|
|||||||
$output = ["Status" => "Fail"]; // Default Status is "Fail"
|
$output = ["Status" => "Fail"]; // Default Status is "Fail"
|
||||||
if (isLoggedIn()) {
|
if (isLoggedIn()) {
|
||||||
$query = $mysqli->prepare("INSERT INTO NewsArticles (WrittenBy, Title, Body, FileList) VALUES (?, ?, ?, ?);");
|
$query = $mysqli->prepare("INSERT INTO NewsArticles (WrittenBy, Title, Body, FileList) VALUES (?, ?, ?, ?);");
|
||||||
$query->bind_params("issi", $_SESSION["id"], htmlspecialchars($title), htmlspecialchars($body), 0);
|
$query->bind_param("issi", $_SESSION["id"], htmlspecialchars($title), htmlspecialchars($body), 0);
|
||||||
$query->execute();
|
$query->execute();
|
||||||
if ($query->affected_rows > 0) {
|
if ($query->affected_rows > 0) {
|
||||||
$output["Status"] = "Success";
|
$output["Status"] = "Success";
|
||||||
|
Loading…
Reference in New Issue
Block a user