function bookingConf($room, $building, $startDate, $startTime, $endTime, $reason, $desc, $numP, $db) { $notifyAdmin = False; $to = userEmail(); $details = roomDetails($room, $db); $key = $details['key']; $fee = $details['fee']; $msg = ""; $msg2 = "You have successfully booked:\n"; $msg .= "\nBuilding: {$building}"; $msg .= "\nRoom: {$room}"; $msg .= "\nDate: {$startDate}"; $msg .= "\nTime: {$startTime} - {$endTime}"; $msg .= "\nNumber of Participants: {$numP}"; $msg .= "\nKey Required: {$key}"; $msg .= "\nFee: {$fee}"; $msg .= "\nReason: {$reason}"; if ($reason == "Other") { $msg .= "\nDescription: {$desc}"; $notifyAdmin = True; } elseif ($reason == "Coursework" || $reason == "Course") { $msg .= "\nCourse Code: {$desc}"; } $msg2 .= $msg; sendEmail($to, "Booking Confirmation", $msg2); //Admins must be notified of all bookings with Reason: Other if ($notifyAdmin == True) { $name = $_SERVER['HTTP_COMMON_NAME']; otherBooking($msg, $name, $to); } }
$response['message'] = "Uhoh! You already have 10 classes on your watch-list for this term. You need to remove a class before you can add some more."; echo json_encode($response); exit(0); } // check if user course exists in the user_courses table $query = "SELECT email FROM user_courses WHERE email='" . userEmail() . "' AND term=" . $term . " AND deptAbbreviation='" . $deptAbbreviation . "' AND sectionNumber=" . $sectionNumber; $result = mysqli_query($link, $query); if (mysqli_num_rows($result) == 0) { // insert into user course $insertQuery = "INSERT INTO user_courses (email,sectionNumber, deptAbbreviation, term) VALUES ('" . userEmail() . "'," . $sectionNumber . ",'" . $deptAbbreviation . "'," . $term . ")"; mysqli_query($link, $insertQuery); if (mysqli_errno($link) != 0) { sqlCommRollChanges(1, $link, $publishedCourseName); } // set first_login to false $updateQuery = "UPDATE users SET first_login=0 WHERE email='" . userEmail() . "'"; mysqli_query($link, $updateQuery); if (mysqli_errno($link) != 0) { sqlCommRollChanges(1, $link, $publishedCourseName); } } sqlCommRollChanges(0, $link, $publishedCourseName); // check the sql_error flag to see if there were any errors in the sql queries // if there were rollback the changes and echo error // else commit changes and echo success function sqlCommRollChanges($sql_error, $sqlLink, $pcn) { $response = ""; if ($sql_error == 0) { mysqli_commit($sqlLink); $response['message'] = "The course " . $pcn . " was successfully added to your watch-list";
case "AT&T": $carrier_code = "@txt.att.net"; break; case "MetroPCS": $carrier_code = "@mymetropcs.com"; break; case "Sprint": $carrier_code = "@messaging.sprintpcs.com"; break; case "T-Mobile": $carrier_code = "@tmomail.net"; break; case "U.S. Cellular": $carrier_code = "@email.uscc.net"; break; case "Verizon": $carrier_code = "@vtext.com"; break; default: exit(0); } $phone_vrf_code = rand(1000, 9999); $to = $phone_number . $carrier_code; $headers = "From: no_reply@hummingbirdapplication.com" . "\r\n"; $message = "Hummingbird Mobile confirmation code: " . $phone_vrf_code; $updateQuery = "UPDATE users SET phone_number='" . $phone_number . "', carrier='" . $carrier . "', carrier_code='" . $carrier_code . "', phone_vrf_code='" . $phone_vrf_code . "' WHERE email='" . userEmail() . "'"; mysqli_query($link, $updateQuery); ini_set('sendmail_from', '*****@*****.**'); $response['status'] = mail($to, "", $message, $headers, "*****@*****.**"); echo json_encode($response); exit(0);
returnWeeklyHoursToUser($db, $week, $bookingUserID, 0.5); } else { returnSpecialHoursToUser($db, $bookingUserID, $hrsSourceList[$i], 0.5); } } http_response_code(200); //success } else { //otherwise they are admin or deleting a faculty booking deleteBooking($db, $bookingID); //check if admin is deleting a different user's booking if ($bookingUserID != $_SESSION["netID"]) { $to = $bookingUserID . "@queensu.ca"; cancelBooking($room, $building, $startDate, $start, $end, $reason, $desc, $numP, $db, $to, true); } else { $to = userEmail(); cancelBooking($room, $building, $startDate, $start, $end, $reason, $desc, $numP, $db, $to, false); } } http_response_code(200); //sucess } } } //Close the connection $db = NULL; //retrieve the hrsSource for each 30 minute block of a booking //return an array with the hours to return function retrieveHrsSource($db, $bookingID) { global $hrsSourceList;
<div id='master-wrapper'> <div id='main-content'> <div id='settings-description'>SETTINGS</div> <div id='settings-main-content'> <div id='settings-static-elements'> <div class='static-element'> <span class='element-description'>Name:</span> <span class='static-element-content'><?php echo $name; ?> </span> </div> <div class='static-element'> <span class='element-description'>E-Mail:</span> <span class='static-element-content'><?php echo userEmail(); ?> </span> </div> </div> <div id='phone-content-wrapper'> <div id='phone-settings'> <?php if ($r['vrf_phone'] == 1) { echo "<div class='static-element'>"; echo "<span class='element-description' style='float:left'>Mobile:</span>"; echo "<span class='static-element-content' style='float:left'>"; $phone_number = $r['phone_number']; $expanded_phone_number = substr($phone_number, 0, 3) . "-" . substr($phone_number, 3, 3) . "-" . substr($phone_number, 6, 4); echo $expanded_phone_number; echo " on " . $r['carrier'];
echo "Fall " . substr($r['term'], 0, -1); break; } ?> </td> <td class='location-data'> <?php $location = $r['location']; $building = substr($location, 0, 3); $room = substr($location, 3); echo $building . "-" . $room; ?> </td> <td class='options-data'> <?php $removeCourseData = "('" . userEmail() . "','" . $r['term'] . "','" . $r['deptAbbreviation'] . "','" . $r['sectionNumber'] . "','" . $r['courseType'] . "')"; ?> <a href="javascript:confirmDeleteCourse<?php echo $removeCourseData; ?> "><div class='ui-x-icon'></div></a> </td> </tr> </table> </div> <?php } } ?> <div class='clear'></div> </div> <!--End Master Wrapper-->
<?php require_once "../global/includes/db-open.php"; require_once "../global/includes/gbFunctions.php"; $response = ""; $query = "SELECT user_num FROM users WHERE email='" . userEmail() . "' AND phone_vrf_code='" . $_GET['phone_vrf_code'] . "'"; $result = mysqli_query($link, $query); if (mysqli_num_rows($result) == 1) { $updateQuery = "UPDATE users SET vrf_phone=1, text_notify=1 WHERE email='" . userEmail() . "'"; mysqli_query($link, $updateQuery); $response['status'] = 0; } else { $response['status'] = 1; } echo json_encode($response); exit(0);
<?php require_once "../global/includes/db-open.php"; require_once "../global/includes/gbFunctions.php"; $updateQuery = "UPDATE users SET text_notify=0, phone_number='', carrier='', carrier_code='', vrf_phone=0, phone_vrf_code='' WHERE email='" . userEmail() . "'"; mysqli_query($link, $updateQuery); echo 0; exit(0);
<?php require_once "../global/includes/db-open.php"; require_once "../global/includes/gbFunctions.php"; $text_notify = $_GET['text_notify']; switch ($text_notify) { case 'E': $text_notify = 1; break; case 'D': $text_notify = 0; break; } $updateQuery = "UPDATE users SET text_notify={$text_notify} WHERE email='" . userEmail() . "'"; mysqli_query($link, $updateQuery); echo 0; exit(0);