-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
46 lines (30 loc) · 953 Bytes
/
delete.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
/**
* I Have Plans -- Delete controller
* @author Steven Dufresne <[email protected]>
* @link http://github.com/StevenDufresne/web-app
* @copyright 2012 Steven Dufresne
* @license BSD-3-Clause <https://github.com/stevendufresne/web-app/BSD-3-CLAUSE-LICENSE.txt>
*/
require_once 'includes/db.inc.php';
require_once 'includes/requests.inc.php';
require_once 'includes/users.inc.php';
$user_id = $_SESSION['user-id'];
$event_id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING);
//handle the delete click
if ( isset($_SESSION['delete-event']) ){
delete_event ( $db, $user_id, $event_id );
unset( $_SESSION['delete-event'] );
header('Location: calendar.php');
exit;
} else {
if ( empty($user_id) ) {
header('Location: friends.php');
exit;
} else {
$friend_id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING);
delete_friend($db, $user_id, $friend_id);
header('Location: friends.php');
exit;
}
}