-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmember_sign_in.php
52 lines (38 loc) · 1.29 KB
/
member_sign_in.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
<?php
//Model
include('attendance_model.php');
$error_message = '';
//Controller
$get_variables = $_GET;
if($get_variables['action']=='start_event_sign_in') {
$post_variables = $_POST;
session_start();
$_SESSION['event_id'] = $post_variables['event_id'];
$_SESSION['event_name'] = selectEventName($_SESSION['event_id']);
}
else if ($get_variables['action']=='sign_in') {
$post_variables = $_POST;
$student_id = $post_variables['student_id'];
session_start();
$member_id = validateMemberForEvent($student_id, $_SESSION['club_id']);
if (!is_null($member_id)) {
session_start();
//insert attendance of student id
date_default_timezone_set('America/New_York');
$last_login_date_time = date('Y-m-d H:i:s');
$attendance_id = insertAttendance($_SESSION['event_id'], $member_id, $last_login_date_time);
$error_message= 'You have successfully signed into this event!';
}
else {
header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/member_sign_in.php?action=invalid_student_id");
exit();
}
}
else if ($get_variables['action']=='invalid_student_id') {
$error_message = 'Student ID not recognized, please go back and join this club!';
}
session_start();
$data[event_name] = $_SESSION['event_name'];
//View
include('member_sign_in_view.php');
?>