-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent.php
61 lines (40 loc) · 1.36 KB
/
event.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* I Have Plans -- Event 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/users.inc.php';
require_once 'includes/requests.inc.php';
if ( !user_is_signed_in() ) {
header('Location: index.php');
exit;
}
$user_id = $_SESSION['user-id'];
$event_id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING);
//get the event information
$event_info = get_event_loc_title ( $db, $event_id );
//get the location
$location = get_location ( $db, $event_info['location_id'] );
//get event users
$confirmed_user_ids = get_event_user ( $db, $event_id );
//get event date
$event_date = get_event_date ( $db, $event_id ) ;
//fix date to our liking
$date = $event_date[0][2];
$day = date("l", strtotime($date));
$day_month = substr($date, 0, 5);
$date_string = $day.' '.$day_month.' at '. $event_date[0][1];
//handle the confirmed click
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$event_id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING);
$ok = update_user_confirmation ( $db, $user_id, $event_id );
$_SESSION['confirmed'] = true;
header('Location: calendar.php');
exit;
}
include "views/event.html.php";
?>