Add article creation frontend

This commit is contained in:
Bruno Rybársky 2024-02-22 12:25:32 +01:00
parent e0636c4411
commit 37c0827cdf

@ -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 (?, ?, ?, 0);"); $query = $mysqli->prepare("INSERT INTO NewsArticles (WrittenBy, Title, Body, FileList) VALUES (?, ?, ?, 0);");
$query->bind_param("issi", $_SESSION["id"], htmlspecialchars($title), htmlspecialchars($body)); $query->bind_param("iss", $_SESSION["id"], htmlspecialchars($title), htmlspecialchars($body));
$query->execute(); $query->execute();
if ($query->affected_rows > 0) { if ($query->affected_rows > 0) {
$output["Status"] = "Success"; $output["Status"] = "Success";