forked from pipiscrew/fullcalendar-php-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_dayoff.php
42 lines (32 loc) · 931 Bytes
/
update_dayoff.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
<?php
@session_start();
if (!isset($_SESSION["id"])) {
echo json_encode(1);
exit;
}
else {
date_default_timezone_set("UTC");
if ($_SESSION["login_expiration"] != date("Y-m-d"))
{
session_destroy();
echo json_encode(2);
exit;
}
}
if (!isset($_POST["day_off_id"]) || !isset($_POST["eventdate"])) {
echo json_encode(3);
exit;
}
include 'config.php';
$db = connect();
$sql = "update day_offs set date_occur=:date_occur where day_off_id=:day_off_id";
$stmt = $db->prepare($sql);
$stmt->bindValue(':date_occur' , $_POST['eventdate']);
$stmt->bindValue(':day_off_id' , $_POST['day_off_id']);
$stmt->execute();
$res = $stmt->rowCount();
if($res == 1)
echo json_encode(100);
else
echo json_encode(0);
?>