forked from libertempo/web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalcul_nb_jours_pris.php
43 lines (34 loc) · 1.24 KB
/
calcul_nb_jours_pris.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
define('ROOT_PATH', '');
define('INCLUDE_PATH', ROOT_PATH . 'includes/');
require_once INCLUDE_PATH . 'define.php';
include_once INCLUDE_PATH . 'session.php';
/*** initialisation des variables ***/
$user="";
$date_debut="";
$date_fin="";
$p_num="";
/*************************************/
// recup des parametres reçus :
// SERVER
$PHP_SELF = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL);
// GET / POST
$user = getpost_variable('user') ;
$date_debut = getpost_variable('date_debut') ;
$date_fin = getpost_variable('date_fin') ;
$opt_debut = getpost_variable('opt_debut') ;
$opt_fin = getpost_variable('opt_fin') ;
$p_num = getpost_variable('p_num') ;
/*************************************/
if($user !== "" && $date_debut !== "" && $date_fin !== "" && $opt_debut !== "" && $opt_fin !== "")
affichage($user, $date_debut, $date_fin, $opt_debut, $opt_fin, $p_num);
/********** FONCTIONS ****************************************/
function affichage($user, $date_debut, $date_fin, $opt_debut, $opt_fin, $p_num="")
{
$comment=" " ;
// calcul :
$nb_jours = compter($user, $p_num, $date_debut, $date_fin, $opt_debut, $opt_fin, $comment);
$tab['nb'] = $nb_jours;
$tab['comm'] = $comment;
echo json_encode($tab);
}