$recurrenceId = $db->lastInsertId(); $typeId = "SELECT increment_string FROM recurrence r JOIN recurrence_type rt ON r.recurrence_type_id = rt._id WHERE r._id = " . $recurrenceId; $stmt = $db->prepare($typeId); $result = $stmt->execute(); $row = $stmt->fetch(); $incrementString = $row['increment_string']; $currentDate = strtotime($_GET['date']); $recurrenceEndDate = strtotime($_GET['rec_end']); while ($currentDate <= $recurrenceEndDate) { $insertParams = array(':user_id' => $_GET['user_id'], ':conference_room_id' => $_GET['room_id'], ':time_slot_id' => $_GET['time_slot'], ':recurrence_id' => $recurrenceId, ':date_val' => date("Y-n-d", $currentDate)); try { $stmt = $db->prepare($insertStatement); $result = $stmt->execute($insertParams); } catch (PDOException $ex) { $error = true; echo "query: " . $insertStatement . "</br>"; print_r($insertParams); echo "<br/>exception: " . $ex->getMessage(); } $currentDate = strtotime($incrementString, $currentDate); } if (!$error) { $mailer = new SendEmail(); $mailer->SendEmail($_SESSION['user']['email'], "Conference Room Scheduler", "A new reservation has been scheduled for you!<br/>To view your reservations, please use the following link:<br/><br/>http://dbsystems-engproject.rhcloud.com/src/view_meetings.php?type=me", false); header("Location: home.php"); die("Redirecting to home.php"); } } } else { echo "You have hit the max number of reservations! Unable to schedule another."; }
function sendEmailToUser($userEmail, $name) { $message = 'Hello, ' . $name . '!<br/><br/>' . 'You recently deleted an appointment.<br/><br/>Thank you,<br/>Wal Consulting'; $email = new SendEmail(); return $email->SendEmail($userEmail, "Appointment Deleted", $message, false); }
function sendEmailToNurse() { $message = 'Hello!<br/><br/>' . $this->patientName . ' requested an appointment reschedule with you on ' . $this->date . ' at ' . $this->time . '. The doctor will be ' . $this->doctorName . '.<br/><br/>Thank you,<br/>Wal Consulting'; $email = new SendEmail(); return $email->SendEmail($this->nurseEmail, "Appointment Confirmation", $message, false); }
<?php include_once '../AutoLoader.php'; AutoLoader::registerDirectory('../src/classes'); require "config.php"; require "MailFiles/PHPMailerAutoload.php"; $query = "SELECT _id\n FROM reservation \n WHERE conference_room_id = :room_id \n AND date = :get_date\n AND time_slot_id = :timeslot"; $query_params = array(':room_id' => $_GET['room_id'], ':get_date' => $_GET['date'], ':timeslot' => $_GET['time_slot']); try { $stmt = $db->prepare($query); $result = $stmt->execute($query_params); } catch (PDOException $ex) { die("Failed to run query: " . $ex->getMessage()); } $row = $stmt->fetch(); $insertStatement = "INSERT INTO waitlist (`blocking_reservation_id`, `user_id`) \n VALUES (:reservation_id, :user_id)"; $insertParams = array(':reservation_id' => $row['_id'], ':user_id' => $_SESSION['user']['_id']); try { $stmt = $db->prepare($insertStatement); $result = $stmt->execute($insertParams); $mailer = new SendEmail(); $mailer->SendEmail($_SESSION['user']['email'], "Conference Room Scheduler", "You have been added to a waitlist.<br/>If the room becomes available, you will be notified immediately.", false); header("Location: home.php"); die("Redirecting to home.php"); } catch (PDOException $ex) { echo "query: " . $insertStatement . "</br>"; print_r($insertParams); echo "<br/>exception: " . $ex->getMessage(); }
include_once '../AutoLoader.php'; AutoLoader::registerDirectory('../src/classes'); require "config.php"; require "MailFiles/PHPMailerAutoload.php"; if (empty($_SESSION['user'])) { header("Location: ../index.php"); die("Redirecting to index.php"); } $query = "SELECT _id, email\n FROM user\n WHERE user_type_id = 2"; $error = false; try { $stmt = $db->prepare($query); $result = $stmt->execute(); $mailer = new SendEmail(); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $mailer->SendEmail($row['email'], "Conference Room Scheduler - Monthly Report", "Hello Manager!<br/>\n Below is a link to the monthly report for your created users reservations. If anything looks out of place, feel free to contact the system administrator for help.<br/><br/>" . '<a href="http://dbsystems-engproject.rhcloud.com/src/monthly_report.php?user_id=' . $row['_id'] . '">Monthly Usage Report</a>', false); } } catch (PDOException $ex) { $error = true; echo $e->getMessage(); } ?> <!doctype html> <html lang="en"> <head> <style>.error {color: #FF0000;}</style> <style>.success {color: #00FF00;}</style> <meta charset="utf-8"> <title>Conference Room</title> <meta name="description" content="Conference room management system for Database Systems">
function sendRegistrationEmail($userEmail, $link) { $message = 'Hello!<br/><br/>' . 'Thanks for registering for an account through our Hospital' . ' Management System! Please click <a href=' . $link . '>here</a> to verify your account.' . '<p>If you are having trouble with the link, paste the link below directly into your' . ' browser:<br/><br/>' . $link . '<br/><br/>Thank you,<br/>Wal Consulting'; $email = new SendEmail(); return $email->SendEmail($userEmail, "Account verification request", $message, false); }
} } } catch (PDOException $ex) { die("Failed to run query: " . $ex->getMessage()); } } else { $deleteStatement = "DELETE FROM reservation \n WHERE _id = :reservation_id"; $deleteParams = array(':reservation_id' => $_GET['reservation_id']); $query = "SELECT email, conference_room_id, w.user_id AS user_id, date\n FROM waitlist w \n JOIN user u ON w.user_id = u._id \n JOIN reservation res ON w.blocking_reservation_id = res._id\n WHERE blocking_reservation_id = :id"; $query_params = array(':id' => $_GET['reservation_id']); try { $stmt = $db->prepare($query); $result = $stmt->execute($query_params); while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $mailer = new SendEmail(); $mailer->SendEmail($row['email'], "Conference Room Scheduler", 'One of your waitlisted rooms is now available. To claim it, visit <a href="http://dbsystems-engproject.rhcloud.com/src/pick_time.php?submitted=false&date=' . $row['date'] . '&room_id=' . $row['conference_room_id'] . '&user_id=' . $row['user_id'] . '">here</a>', false); } } catch (PDOException $ex) { die("Failed to run query: " . $ex->getMessage()); } } try { $stmt = $db->prepare($deleteStatement); $result = $stmt->execute($deleteParams); header("Location: home.php"); die("Redirecting to home.php"); } catch (PDOException $ex) { echo "query: " . $deleteStatement . "</br>"; print_r($deleteParams); echo "<br/>exception: " . $ex->getMessage(); }
<?php include_once '../AutoLoader.php'; AutoLoader::registerDirectory('../src/classes'); require "config.php"; require "MailFiles/PHPMailerAutoload.php"; $realPassword = PasswordUtils::generateNewPassword(); $passwordSalt = PasswordUtils::generatePasswordSalt(); $hashedPassword = PasswordUtils::hashPassword($realPassword, $passwordSalt); $email = $_POST['email']; $created_by_id = $_SESSION['user']['_id']; if (!empty($_POST['manager'])) { $created_by_id = $_POST['manager']; } $insertStatement = "INSERT INTO user\n\t\t\t\t\t(`user_type_id`, `created_by_id`, `password`, `password_salt`, `first_name`, `last_name`, `email`, `picture_url`) \n\t\t\t\t\tVALUES (:user_type_id,:created_by_id, :password,:password_salt,:first_name,:last_name,:email,:picture_url)"; $insertParams = array(':user_type_id' => $_POST['user_type_id'], ':created_by_id' => $created_by_id, ':password' => $hashedPassword, ':password_salt' => $passwordSalt, ':first_name' => $_POST['first'], ':last_name' => $_POST['last'], ':email' => $email, ':picture_url' => 'https://s3-us-west-2.amazonaws.com/dbsystems/default-avatar.png'); try { $stmt = $db->prepare($insertStatement); $result = $stmt->execute($insertParams); $link = "http://dbsystems-engproject.rhcloud.com/"; $message = 'Hello!<br/><br/>' . 'An account has been created for you on our conference room scheduler!' . ' Please click <a href=' . $link . '>here</a> to log in.<br/><br/>' . 'Password: '******'<br/>To change your password, sign in, then select \'Change Password\'' . ' from the drawer on the left side of the screen.' . '<br/><br/>Thank you,<br/>Team 6'; $mailer = new SendEmail(); $mailer->SendEmail($email, "Conference Room Scheduler", $message, false); header("Location: home.php"); die("Redirecting to home.php"); } catch (PDOException $ex) { echo "query: " . $insertStatement . "</br>"; print_r($insertParams); echo "<br/>exception: " . $ex->getMessage(); }