-
Notifications
You must be signed in to change notification settings - Fork 0
/
dispatchConfirmation.php
132 lines (101 loc) · 3.18 KB
/
dispatchConfirmation.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<?php
/*
* dispatchConfirmation.php - pdweek v1.3
*/
session_start();
require_once( "data/environment.php" );
require_once( "lib/logging.php" );
?>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Georgian College :: <?=$str_pdweekName;?> <?=$str_currentYear;?></title>
<!--
JQuery-UI css definitions were manually implemented in gl.css
to fix IE11 performance issue when full jquery-ui.css was
loaded.
-->
<link rel="stylesheet" href="css/gl.css">
</head>
<body>
<div class="main ui-corner-bottom">
<div class="ui-widget">
<?php
include 'pdweek.php';
?>
<div class="ui-state-info ui-corner-all" style="padding: 0 .7em; background: none; border-size: 2px">
<?php
$errorMessage = (string) '';
if( !isset( $_SESSION['emailReference'] ) ) {
$errorMessage .= 'Missing the Message,';
}// end if statement
if( !isset( $_SESSION['emailHeaders'] ) ) {
$errorMessage .= 'Missing the Mail Headers,';
}// end if statement
if( !isset( $_SESSION['email'] ) ) {
$errorMessage .= 'Missing the Address to send to,';
}// end if statement
if( $errorMessage == '' ) {
$email = $_SESSION['email'];
$emailReference = $_SESSION['emailReference'];
$emailHeaders = $_SESSION['emailHeaders'];
//Dispatch the mail
$deliveryResult = mail($email, 'PD Week Registration Confirmation', $emailReference, $emailHeaders);
if( !$deliveryResult ) {
echoToConsole( 'Failed to dispatch the reference email!', true );
echo <<<END
<div class="upper-space lower-space ui-state-error ui-corner-all">
<p>Failed to dispatch the reference email!</p>
</div>
END;
} else {
echoToConsole( "Mail dispatched to {$email}", true );
echo <<<END
<div class="upper-space lower-space ui-state-info ui-corner-all">
<p>Thank you for confirming your PD Week sessions. An email has been sent to {$email} which contains your profile and session information. It also contains a link that you can use to get back and review your PD Week Registration profile at any time.</p>
</div>
END;
}// end if statement
} else {
echoToConsole( "There was an error while processing your input. Here are the errors: {$errorMessage}", true );
echo <<<END
<div class="upper-space lower-space ui-state-error ui-corner-all">
<p>
There was an error while processing your input. Here are the errors:<br><br>
{$errorMessage}
</p>
</div>
END;
}// end if statement
?>
</div>
</div>
</div>
</body>
</html>
<?php
/**
* Destroy the session data
*/
$_SESSION['emailReference'];
$_SESSION['emailHeaders'];
$_SESSION['email'];
/**
* On second thought, maybe destroying georgianc.on.ca's cookie
* is not a good idea? hehe!
//Empty the entire global session array
$_SESSION = (array) Array();
//Recreate the session cookie
$cookie_params = session_get_cookie_params();
setcookie( session_name(), '', 0,
$cookie_params['path'],
$cookie_params['domain'],
$cookie_params['secure'],
$cookie_params['httponly']
);//name, value, expireIn, path, domain, sslOnly, httpOnly
*
*/
session_destroy();
?>