Nimbin[12]?Web & Tools / dienstplancreator / api/roster_person_info/update.php

dienstplancreator git · main

Dienstplan (roster) creator, PHP/JS web app

php javascript roster web · first commit 2023-07-13 · last commit 2023-09-14 (3 years ago) · synced 3 days ago · upstream: github.com/nimbin2/dienstplancreator

JavaScript 50% PHP 40.5% CSS 8.5%
git clone https://git.christianimmanuel.de/web-tools/dienstplancreator.gitwget https://git.christianimmanuel.de/web-tools/dienstplancreator/archive/dienstplancreator.tar.gz
api/roster_person_info/update.php 890 B · 34 lines raw
<?php
// required headers
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With");
  
session_start();

if ($_SESSION['administration'] === 'visitor' ) {return;}


require '../config/db_inc.php';
require '../objects/roster_person_info_class.php';

$roster_person_info = new Roster_person_info();

$data = json_decode(file_get_contents("php://input"));

$data_id    = $_SESSION["data_id"];
$id  = $data->id;
$yearweek   = $data->yearweek;
$day_id     = $data->day_id;
$text       = $data->text;


try {
	$roster_person_info->update($data_id, $id, $yearweek, $day_id, $text);
} catch (Exception $e) {
	error_log($e->getMessage());
	die();
}   
?>