Event Backend für das AdminPanel
This commit is contained in:
48
admin/events/editEvent.php
Executable file
48
admin/events/editEvent.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
include("../../../mysqlverbinden.php");
|
||||
include("../secret.php");
|
||||
include("../../vendor/autoload.php");
|
||||
|
||||
include("../check.php");
|
||||
|
||||
$payload=getUserInfo();
|
||||
|
||||
$username=$payload->username;
|
||||
$id=$payload->id;
|
||||
|
||||
$rawBody = file_get_contents('php://input');
|
||||
|
||||
$_POSTBODY = json_decode($rawBody, true);
|
||||
|
||||
if($_POSTBODY===null) die("Kein Body übertragen");
|
||||
|
||||
|
||||
if(!isset($_POSTBODY["eventname"])) die("POSTBODY eventname fehlt");
|
||||
$eventname=$_POSTBODY["eventname"];
|
||||
|
||||
if(!isset($_POSTBODY["datum"])) die("POSTBODY datum fehlt");
|
||||
$datum=$_POSTBODY["datum"];
|
||||
|
||||
if(!isset($_POSTBODY["type"])) die("POSTBODY type fehlt");
|
||||
$type=$_POSTBODY["type"];
|
||||
|
||||
if(!isset($_POSTBODY["content"])) die("POSTBODY content fehlt");
|
||||
$content=$_POSTBODY["content"];
|
||||
|
||||
if(!isset($_POSTBODY["minitext"])) die("POSTBODY minitext fehlt");
|
||||
$minitext=$_POSTBODY["minitext"];
|
||||
|
||||
if(!isset($_POSTBODY["link"])) $link=null;
|
||||
else $link=$_POSTBODY["link"];
|
||||
|
||||
if(!isset($_POSTBODY["foto"])) die("POSTBODY foto fehlt");
|
||||
$foto=$_POSTBODY["foto"];
|
||||
|
||||
if(!isset($_POSTBODY["id"])) die("POSTBODY id fehlt");
|
||||
$eventid=$_POSTBODY["id"];
|
||||
|
||||
if(mysqli_execute_query($db_id,"SELECT COUNT(*) FROM `ritzenbergen-events` WHERE `id`=?;",[$eventid])->fetch_assoc()["COUNT(*)"]!=1) die("Dieses Event gibt es nicht");
|
||||
|
||||
mysqli_execute_query($db_id,"UPDATE `ritzenbergen-events` SET `eventname`=?,`datum`=?,`type`=?,`content`=?,`minitext`=?, `link`=?, `foto`=? WHERE `id`=?;",[$eventname,$datum,$type,$content,$minitext,$link,$foto,$eventid]);
|
||||
|
||||
echo '{"success":true}';
|
||||
Reference in New Issue
Block a user