Nimbin[12]?Web & Tools / dienstplancreator / api/shifts/updateWhereId.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/shifts/updateWhereId.php 849 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/shift_class.php';

$shifts = new Shift();

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

$data_id    = $_SESSION["data_id"];
$id         = $data->id;
$start      = $data->start;
$end        = $data->end;


try {
	$shift_id = $shifts->updateWhereId($data_id, $id, $start, $end);
} catch (Exception $e) {
	error_log($e->getMessage());
	die();
}   
echo json_encode($shift_id);
?>