summaryrefslogtreecommitdiff
path: root/src/post-ajax.php
blob: bedfed54d835d0ec0d4d47f9364820150a54a6e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
session_start();

if(isset($_SESSION['admin']) && $_SESSION['admin'] === true && $_SERVER['REQUEST_METHOD'] === 'POST'){ // && $_SESSION['admin'] === true
	if($_SERVER['CONTENT_TYPE'] === 'application/json'){
		$data = file_get_contents('php://input');
		$json = json_decode($data, true);
		//var_dump($json);
		
		$id = isset($json['id']) ? $json['id'] : 7; // = id_event en BDD si nouvel évènement
		echo json_encode(['success' => true, 'id' => $id]);
		die;
	}
}