-
Notifications
You must be signed in to change notification settings - Fork 0
/
messageManagement.php
45 lines (41 loc) · 1.57 KB
/
messageManagement.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
44
45
<?php
session_start();
if($_SESSION['user_name'] === null){
header('location: sign.php');
}
require 'userDAO.php';
require 'messageDAO.php';
$userDAO = new userDAO();
$messageDAO = new messageDAO();
$user_email = $userDAO->get_userEmail($_SESSION['user_name']);
$method = $_GET['method'];
$target = $_GET['target'];
$selected = $_SESSION['selected'];
if($method === 'allDelete'){
$messageDAO->all_delete($user_email);
$_SESSION['page'] = 1;
}else if($method === 'selectDelete'){
$targetList = explode(',', $target);
$messageDAO->select_delete($user_email, $targetList, $selected);
$_SESSION['page'] = 1;
}else if($method === "selectImportant"){
$targetList = explode(',', $target);
$messageDAO->select_important($user_email, $targetList, $selected);
}else if($method === "allRemove"){
$targetList = explode(',', $target);
$messageDAO->all_remove($user_email);
$_SESSION['page'] = 1;
}else if($method === "selectRecover"){
$targetList = explode(',', $target);
$messageDAO->select_recover($user_email, $targetList, $selected);
$_SESSION['page'] = 1;
}else if($method === "selectRemove"){
$targetList = explode(',', $target);
$messageDAO->select_remove($user_email, $targetList, $selected);
$_SESSION['page'] = 1;
}else if($method === "toggleImportant"){
// By click star
$messageDAO->toggleImportant($user_email, $target, $selected);
}
header('location: message.php');
?>