-
Notifications
You must be signed in to change notification settings - Fork 0
/
or-reserve.php
518 lines (470 loc) · 24.1 KB
/
or-reserve.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
<?php
session_start();
require_once("includes/or-dbinfo.php");
require_once("includes/ClockTime.php");
//Check if user is logged in. Set $username accordingly.
$username = isset($_SESSION["username"])?$_SESSION["username"]:"";
//Check if user is an administrative user. Set $isadministrator accordingly.
$isadministrator = isset($_SESSION["isadministrator"])?$_SESSION["isadministrator"]:"FALSE";
//Only allow reservations if a user is logged in
if($username != ""){
//These three values must be sent with every reservation request
$duration = filter_var((isset($_POST["duration"])?$_POST["duration"]:""), FILTER_SANITIZE_NUMBER_INT);
$roomid = filter_var((isset($_POST["roomid"])?$_POST["roomid"]:""), FILTER_SANITIZE_NUMBER_INT);
$starttime = filter_var((isset($_POST["starttime"])?$_POST["starttime"]:""), FILTER_SANITIZE_NUMBER_INT);
$endtime = $starttime + ($duration * 60);
$capacity = filter_var((isset($_POST["capacity"])?$_POST["capacity"]:""), FILTER_SANITIZE_NUMBER_INT);
$fullcapacity = filter_var((isset($_POST["fullcapacity"])?$_POST["fullcapacity"]:""), FILTER_SANITIZE_NUMBER_INT);
//$onlychecking is used when only checking to see if a reservation is POSSIBLE and will not actually place it
$onlychecking = (isset($_POST["onlychecking"])?$_POST["onlychecking"]:"FALSE");
//$altusername is used when an administrator is reserving a room for a different user
//This only needs to be used during the final phase of reserving, since admins are omitted from the rules
//Therefore you don't need to replace all isntances of $username with this, only on the final inserts
$altusername = (isset($_POST["altusername"])?$_POST["altusername"]:"");
$emailconfirmation = (isset($_POST["emailconfirmation"])?$_POST["emailconfirmation"]:"yes");
if($onlychecking == "TRUE" || $onlychecking == "multireserve"){
$capacity = 1;
$fullcapacity = 1;
}
//Make sure these values have been set
if($duration != "" && $roomid != "" && $starttime != "" && $capacity != "" && (int)$capacity > 0 && $fullcapacity != "" && $capacity <= $fullcapacity){
//optional fields
//Grab all optional field records from optionalfields table. Use this
//information to pull the correct fields from POST and to determine required fields
$errormsg = "";
if($onlychecking != "TRUE"){
$optionalfieldsarraytemp = mysql_query("SELECT * FROM optionalfields ORDER BY optionorder ASC;");
while($optionalfield = mysql_fetch_array($optionalfieldsarraytemp)){
//Store sanitized user values in array for later use
$ofvalues[$optionalfield["optionformname"]] = mysql_real_escape_string(isset($_POST[$optionalfield["optionformname"]])?$_POST[$optionalfield["optionformname"]]:"");
//If value is required make sure there is something there
if($optionalfield["optionrequired"] == 1){
if($_POST[$optionalfield["optionformname"]] == ""){
$errormsg .= $optionalfield["optionname"] ." was left blank.<br/>";
}
}
//If optionalfield is a choice field, make sure it is one of the available choices
if($optionalfield["optiontype"] == 1){
$availablechoices = explode(";", $optionalfield["optionchoices"]);
$isachoice = 0;
foreach($availablechoices as $availablechoice){
if($availablechoice == $_POST[$optionalfield["optionformname"]]){
$isachoice = 1;
}
}
if($isachoice == 0){
$errormsg .= $optionalfield["optionname"] ." is invalid.<br/>";
}
}
}
}
//$ofvalues is already sanitized so begin checking the reservation for collisions
//echo $duration ." ". $roomid ." ". $starttime ." ". $endtime ."<br/>";
//foreach($ofvalues as $key => $ofvalue){
// echo $key ." ". $ofvalue ."<br/>";
//}
//See if any reservations for this room exist during the reservation's period
$_POST["fromrange"] = $starttime;
$_POST["torange"] = $endtime - 1; //(must -1 to ensure no undesired collisions)
ob_start();
include("or-getdatarange.php"); //Get any reservation data during the reservation's period
$getdatarange = ob_get_contents();
ob_end_clean();
$xmlreservations = new SimpleXMLElement($getdatarange);
foreach($xmlreservations->reservation as $reservation){
if($reservation->roomid == $roomid){
$errormsg .= "Another room has been reserved during this time.<br/>";
}
if($errormsg == ""){
if($reservation->username == $username && $isadministrator != "TRUE" && $settings["allow_simultaneous_reservations"] == "false"){
$errormsg .= "You have already reserved another room during this time. Please select a different time and try again.<br/>";
}
}
}
//Make sure the room is open (including specialhours) during the entirity of reservation's period
//Basically scan through this room by interval from starttime to endtime and make sure the room is open
$current_check_start = $starttime;
$collision_array = array();
while($current_check_start < $endtime){
$current_check_end = $current_check_start + ($settings["interval"])*60-1;
$current_check_wkdy = strtolower(date("l", $current_check_start));
//Fix POST vars to span from 00:00:00 to 23:59:59 on the current date
$_POST["fromrange"] = mktime(0,0,0,date("m", $starttime),date("j", $starttime),date("Y", $starttime));
$_POST["torange"] = mktime(0,0,0,date("m", $endtime-1),date("j", $endtime-1),date("Y", $endtime-1));
ob_start();
include("or-getroominfo.php");
$getroominfo = ob_get_contents();
ob_end_clean();
$xmlroominfo = new SimpleXMLElement($getroominfo);
//Fetch xml record for this room
$thisroom = "";
foreach($xmlroominfo->room as $room){
if($room->id == $roomid){
$thisroom = $room;
}
}
//If a matching room was found
if($thisroom != ""){
$ccsct = new ClockTime(0,0,0);
$ccsct->setMySQLTime(date("H:i:s",$current_check_start));
$ccect = new ClockTime(0,0,0);
$ccect->setMySQLTime(date("H:i:s",$current_check_end));
//Gather its hours for the current time's weekday and special hours
eval("\$roomhours = \$thisroom->hours->". $current_check_wkdy ."->hourset;");
$specialroomhours = $thisroom->specialhours->hourset;
$collision = "";
foreach($roomhours as $hourset){
$roomstart = new ClockTime(0,0,0);
$roomstart->setMySQLTime((string)$hourset->start);
$roomstop = new ClockTime(0,0,0);
$roomstop->setMySQLTime((string)$hourset->end);
//echo $roomstart->getTime() ." ". $roomstop->getTime() ." ". $ccsct->getTime() ." ". $ccect->getTime() ."<br/>";
//If good collision (bat, spelunker, salamander) has been previously reached skip this step
if($collision != "bat" && $collision != "spelunker" && $collision != "salamander"){
$collision = collisionCave($roomstart, $roomstop, $ccsct, $ccect);
}
}
//If special hours exist for this day, throw away previous results and check special hours instead.
if((string)$specialroomhours->start[0] != ""){
$collision = "";
foreach($specialroomhours as $hourset){
$roomstart = new ClockTime(0,0,0);
$roomstart->setMySQLTime((string)$hourset->start);
$roomstop = new ClockTime(0,0,0);
$roomstop->setMySQLTime((string)$hourset->end);
//echo $roomstart->getTime() ." ". $roomstop->getTime() ." ". $ccsct->getTime() ." ". $ccect->getTime() ."<br/>";
//good collision (bat, spelunker, salamander)
if($collision != "bat" && $collision != "spelunker" && $collision != "salamander"){
$collision = collisionCave($roomstart, $roomstop, $ccsct, $ccect);
}
}
}
}
//Add collision to array
$collision_array[] = $collision;
//Increment for loop
$current_check_start += ($settings["interval"])*60;
}
//Loop through collision array
foreach($collision_array as $collision){
//If collision is NOT bat, spelunker or salamander, set error and break out of the loop because it extends beyond business hours
if($collision != "bat" && $collision != "spelunker" && $collision != "salamander"){
$errormsg .= "This reservation can not be created as it extends beyond business hours.<br/>";
break 1;
}
}
//Check LIMITS for this user and make sure they are allowed to make the reservation
//First check frequency (get all reservations within the specified time range and count the reservations)
//Administrators are not affected by these limits
if($isadministrator != "TRUE"){
$settings_frequency = unserialize($settings["limit_frequency"]);
$sf_count = $settings_frequency[0];
$sf_freq = $settings_frequency[1];
$res_count = 0;
if($sf_count != 0){
switch($sf_freq){
case "day":
//Calculate midnight and last second from the reservation's starttime
$_POST["fromrange"] = mktime(0,0,0,date("m", $starttime),date("j", $starttime),date("Y", $starttime));
$_POST["torange"] = mktime(23,59,59,date("m", $starttime),date("j", $starttime),date("Y", $starttime));
break;
case "week":
//Calculate midnight and last second from the previous Sunday to the following Saturday
if(date("l", $starttime) == "Sunday"){
$_POST["fromrange"] = mktime(0,0,0,date("m", $starttime),date("j", $starttime),date("Y", $starttime));
}
else{
$_POST["fromrange"] = strtotime("last Sunday 00:00:00", $starttime);
}
if(date("l", $starttime) == "Saturday"){
$_POST["torange"] = mktime(23,59,59,date("m", $starttime),date("j", $starttime),date("Y", $starttime));
}
else{
$_POST["torange"] = strtotime("next Saturday 23:59:59", $starttime);
}
break;
case "month":
//Calculate midnight and last second from the first to last day of the month
$_POST["fromrange"] = mktime(0,0,0,date("m", $starttime),1,date("Y", $starttime));
$_POST["torange"] = mktime(23,59,59,date("m", $starttime),date("t", $starttime),date("Y", $starttime));
break;
case "year":
//Calculate midnight and last second from the first to last day of the year
$_POST["fromrange"] = mktime(0,0,0,1,1,date("Y", $starttime));
$_POST["torange"] = mktime(23,59,59,12,31,date("Y", $starttime));
break;
}
ob_start();
include("or-getdatarange.php");
$getdatarange = ob_get_contents();
ob_end_clean();
$xmlreservations = new SimpleXMLElement($getdatarange);
//Now count how many are owned by this user
foreach($xmlreservations->reservation as $reservation){
if($reservation->username == $username){
$res_count++;
}
}
if($res_count >= $sf_count){
$errormsg .= "You may only make ". $sf_count ." reservations per ". $sf_freq .".<br/>";
}
}
//Then in-the-past?
$sapr = $settings["allow_past_reservations"];
if($sapr != "true"){
$nowtime = time();
if($starttime < $nowtime){
$errormsg .= "You may not make reservations in the past.<br/>";
}
}
//Then before Opening Day?
$openingday = $settings["limit_openingday"];
if($openingday != ""){
$openingdaytime = strtotime($openingday);
if($starttime < $openingdaytime){
$errormsg .= "You may not make reservations prior to ". $openingday .".<br/>";
}
}
//Then total
$settings_total = unserialize($settings["limit_total"]);
$st_total = $settings_total[0];
$st_freq = $settings_total[1];
$res_total = 0;
if($st_total != 0){
switch($st_freq){
case "day":
//Calculate midnight and last second from the reservation's starttime
$_POST["fromrange"] = mktime(0,0,0,date("m", $starttime),date("j", $starttime),date("Y", $starttime));
$_POST["torange"] = mktime(23,59,59,date("m", $starttime),date("j", $starttime),date("Y", $starttime));
break;
case "week":
//Calculate midnight and last second from the previous Sunday to the following Saturday
if(date("l", $starttime) == "Sunday"){
$_POST["fromrange"] = mktime(0,0,0,date("m", $starttime),date("j", $starttime),date("Y", $starttime));
}
else{
$_POST["fromrange"] = strtotime("last Sunday 00:00:00", $starttime);
}
if(date("l", $starttime) == "Saturday"){
$_POST["torange"] = mktime(23,59,59,date("m", $starttime),date("j", $starttime),date("Y", $starttime));
}
else{
$_POST["torange"] = strtotime("next Saturday 23:59:59", $starttime);
}
break;
case "month":
//Calculate midnight and last second from the first to last day of the month
$_POST["fromrange"] = mktime(0,0,0,date("m", $starttime),1,date("Y", $starttime));
$_POST["torange"] = mktime(23,59,59,date("m", $starttime),date("t", $starttime),date("Y", $starttime));
break;
case "year":
//Calculate midnight and last second from the first to last day of the year
$_POST["fromrange"] = mktime(0,0,0,1,1,date("Y", $starttime));
$_POST["torange"] = mktime(23,59,59,12,31,date("Y", $starttime));
break;
}
ob_start();
include("or-getdatarange.php");
$getdatarange = ob_get_contents();
ob_end_clean();
$xmlreservations = new SimpleXMLElement($getdatarange);
//Now count how many seconds are being used by this user
foreach($xmlreservations->reservation as $reservation){
if($reservation->username == $username){
$res_total += ((int)$reservation->end + 1) - (int)$reservation->start;
}
}
if((($res_total/60)+$duration) > $st_total){
$errormsg .= "You may only make ". $st_total ." minutes worth of reservations per ". $st_freq .".<br/>";
}
}
//Then duration
if($duration > $settings["limit_duration"]){
$errormsg .= "Each reservation may only be a maximum of ". $settings["limit_duration"] ." minutes.<br/>";
}
//Then Window
$window = unserialize($settings["limit_window"]);
$win_amount = (int)$window[0];
$win_type = (string)$window[1];
//If Window amount is 0, then type should contain date
if($win_amount == 0){
$win_array = explode("/", $win_type);
$win_date = mktime(0,0,0,$win_array[0],$win_array[1],$win_array[2]);
if($starttime >= $win_date){
$errormsg .= "You may not make reservations on or after ". $win_type .".<br/>";
}
}
else{
$s_str = ($win_amount > 1)?"s":"";
$end_time = strtotime("+". $win_amount ." ". $win_type . $s_str);
if($starttime >= $end_time){
$errormsg .= "You may not make reservations more than ". $win_amount ." ". $win_type . $s_str ." in advance.<br/>";
}
}
}//end if $isadministrator != "true"
//else is an administrator
else{
if($altusername != ""){
$username = $altusername;
}
}
//Save everything to the db (if there weren't any errors) and display a success or failure message to the user
if($errormsg == ""){
//MAKE SURE TO END RESERVATIONS ONE MINUTE BEFORE THE SELECTED END TIME FOR COLLISION'S SAKE
//First insert the reservation itself
if($onlychecking != "TRUE"){
$ins_res = mysql_query("INSERT INTO reservations(start,end,roomid,username,numberingroup) VALUES('". date("Y-m-d H:i:s", $starttime) ."','". date("Y-m-d H:i:s", ($endtime - 1)) ."','". $roomid ."','". $username ."','". $capacity ."');");
if($ins_res){
//Grab the new reservationid by grabbing the most recently entered reservation (this one)
$id_res = mysql_query("SELECT * FROM reservations ORDER BY timeofrequest DESC;");
if($id_res){
$id_a = mysql_fetch_array($id_res);
$reservationid = $id_a["reservationid"];
//Then insert the optional field values (reservationoptions table)
foreach($ofvalues as $key => $ofvalue){
//Get the option's name
$opt_name_res = mysql_query("SELECT * FROM optionalfields WHERE optionformname='". $key ."';");
if($opt_name_res){
$opt_name_a = mysql_fetch_array($opt_name_res);
$opt_name = $opt_name_a["optionname"];
$fixedofvalue = htmlspecialchars($ofvalue, ENT_QUOTES);
$fixedofvalue = str_replace("\\","",$fixedofvalue);
$opt_res = mysql_query("INSERT INTO reservationoptions VALUES('". $opt_name ."','". $reservationid ."','". $fixedofvalue ."');");
}
else{
//Optional fields not selectable, remove reservation
$errormsg .= "Error in reserving room. Please try again. If you continue to have problems, please contact an administrator.<br/>";
}
}
}
else{
//Reservation id not selectable, error out
$errormsg .= "Error in reserving room. Please try again. If you continue to have problems, please contact an administrator.<br/>";
}
}
else{
//Reservation could not be made
$errormsg .= "Error in reserving room. Please try again. If you continue to have problems, please contact an administrator.<br/>";
}
if($errormsg == ""){
//Success!
//Run on-success code (send out appropriate emails, etc.)
$email_res_verbose = implode(",", unserialize($settings["email_res_verbose"]));
$email_res_terse = implode(",", unserialize($settings["email_res_terse"]));
$email_res_gef = implode(",", unserialize($settings["email_res_gef"]));
$email_cond_verbose = implode(",", unserialize($settings["email_cond_verbose"]));
$email_cond_terse = implode(",", unserialize($settings["email_cond_terse"]));
$email_cond_gef = implode(",", unserialize($settings["email_cond_gef"]));
$email_system = $settings["email_system"];
//Get user's email address
//If using login_method ldap just use the user's username and the ldap_baseDN dc's
//If using login_method normal you must grab the user's email property from the users table
$user_real = "";
$user_email = "";
$domain = "";
if($settings["login_method"] == "ldap"){
$ldapdn = explode(",", $settings["ldap_baseDN"]);
$count = 0;
foreach($ldapdn as $dn){
if(substr($dn,0,3) == "dc="){
if($count > 0){
$dotstr = ".";
}
$domain .= $dotstr . substr($dn,3);
$count++;
}
}
$user_email = $username ."@". $domain;
$user_real = $_SESSION["displayname"];
$user_real_str = "Name: ". $user_real ."\n\n";
$user_real_gef = "<b>Name</b>: ". $user_real ."<br/><br/>";
}
if($settings["login_method"] == "normal"){
$emailrecord = mysql_query("SELECT * FROM users WHERE username='". $username ."';");
if($emailrecord){
$user_emaila = mysql_fetch_array($emailrecord);
$user_email = $user_emaila["email"];
}
}
//Create verbose, terse and GEF messages.
//VERBOSE
$verbose_msg = "Your room has been reserved!\n\n".
$user_real_str .
"Username: ". $username ."\n\n".
"E-mail: ". $user_email ."\n\n".
"Room: ". $thisroom->name ."\n\n".
"Date and Time: ". date("F j, Y g:i a", $starttime) ." - ". date("F j, Y g:i a", $endtime) ."\n\n".
"Number in Group: ". $capacity ."\n\n";
foreach($ofvalues as $key=>$ofval){
$opname = mysql_fetch_array(mysql_query("SELECT * FROM optionalfields WHERE optionformname='". $key ."';"));
$opname = $opname["optionname"];
$verbose_msg .= $opname .": ". str_replace("\\","",$ofval) ."\n\n";
$gef_msg_of .= "<b>". $opname ."</b>: ". str_replace("\\","",$ofval) ."<br/><br/>";
}
$terse_msg = $verbose_msg;
$verbose_msg .= $settings["policies"] ."\n\n";
$gef_msg = "<html><body>". $user_real_gef ."<b>Date and Time</b>: ". date("F j, Y",$starttime) ." ". date("g:i a", $starttime) ." - ". date("F j, Y",$endtime) ." ". date("g:i a", $endtime) ."<br/><br/><b>Username</b>: ". $username ."<br/><br/>". $gef_msg_of ."</body></html>";
$bccstr = "";
if($email_res_verbose != ""){
$bccstr = "\r\nBcc: ". $email_res_verbose;
}
if($emailconfirmation != "no"){
mail($user_email, $settings["instance_name"] ." Reservation", $verbose_msg, "From: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system . $bccstr, "-f". $email_system);
}
else{
mail($email_res_verbose, $settings["instance_name"] ." Reservation", $verbose_msg, "From: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
}
mail($email_res_terse, $settings["instance_name"] ." Reservation", $terse_msg, "From: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
mail($email_res_gef, "Room: ". $thisroom->name, $gef_msg, "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nFrom: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
//On Condition emails
//Get the current email_condition and email_value
//If condition == "none" skip this, if it is "duration" or "capacity" check those values
//If it is something else, check that particular optional field
if($settings["email_condition"] != "none"){
if($settings["email_condition"] == "duration" && $duration >= $settings["email_condition_value"]){
mail($email_cond_verbose, $settings["instance_name"] ." Reservation (Condition Met)", $verbose_msg, "From: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
mail($email_cond_terse, $settings["instance_name"] ." Reservation (Condition Met)", $terse_msg, "From: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
mail($email_cond_gef, "Room: ". $thisroom->name, $gef_msg, "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nFrom: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
}
elseif($settings["email_condition"] == "capacity" && $capacity >= $settings["email_condition_value"]){
mail($email_cond_verbose, $settings["instance_name"] ." Reservation (Condition Met)", $verbose_msg, "From: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
mail($email_cond_terse, $settings["instance_name"] ." Reservation (Condition Met)", $terse_msg, "From: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
mail($email_cond_gef, "Room: ". $thisroom->name, $gef_msg, "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nFrom: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
}
else{
$thecond = $settings["email_condition"];
if($ofvalues[$thecond] == $settings["email_condition_value"]){
mail($email_cond_verbose, $settings["instance_name"] ." Reservation (Condition Met)", $verbose_msg, "From: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
mail($email_cond_terse, $settings["instance_name"] ." Reservation (Condition Met)", $terse_msg, "From: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
mail($email_cond_gef, "Room: ". $thisroom->name, $gef_msg, "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nFrom: ". $email_system ."\r\nReturn-Path: ". $email_system ."\r\nReply-To: ". $email_system ."", "-f". $email_system);
}
}
}
$tempstr = "Your reservation has been made!<br/>";
if($onlychecking != "multireserve"){
$tempstr .= "|". $starttime ."|". mktime(23,59,59,date("m",$starttime),date("d",$starttime),date("Y",$starttime));
}
echo $tempstr;
}
else{
echo "<strong>Error</strong><br/>". $errormsg ."|". $starttime ."|". mktime(23,59,59,date("m",$starttime),date("d",$starttime),date("Y",$starttime));
}
}//end if onlychecking != true
else{
echo "Your reservation has been made!<br/>";
}
}
else{
echo "<strong>Error</strong><br/>". $errormsg ."|". $starttime ."|". mktime(23,59,59,date("m",$starttime),date("d",$starttime),date("Y",$starttime));
}
}
//Else required info wasn't given
else{
echo "<strong>Error</strong>: There was an error in processing this request as some required information was not provided. Please try again.";
}
}
//Else no user was logged in
else{
echo "<strong>Error</strong>: User is not logged in.";
}
?>