-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdel_user.php
More file actions
52 lines (38 loc) · 1.02 KB
/
del_user.php
File metadata and controls
52 lines (38 loc) · 1.02 KB
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
44
45
46
47
48
49
50
51
52
<?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["user_id"])) {
echo json_encode(3);
exit;
}
include 'config.php';
$db = connect();
//events
$sql = "delete from day_offs where user_id=:user_id";
$stmt = $db->prepare($sql);
$stmt->bindValue(':user_id' , $_POST['user_id']);
$stmt->execute();
$res = $stmt->errorCode();
//user
$sql = "delete from users where user_id=:user_id";
$stmt = $db->prepare($sql);
$stmt->bindValue(':user_id' , $_POST['user_id']);
$stmt->execute();
$res = $stmt->errorCode();
if($res == "0000")
echo json_encode(100);
else
echo json_encode(0);
?>