Testing Framework and Basic Security Controls

profilefijunkie
Demo.zip

Demo/authcheck.php

getTychoname())==0) { // Show the login form again. include('index.html'); ?>

Login Error
Sorry, the username and email do not match any current account.
Try again, or create an account using the link above.

Demo/Cancelit.php

Thank you! The tutoring session has been cancelled."; echo "

Return to search

"; // Retrieve the session information $myschedule=getGroupSchedule($sid); $messageshort = $myschedule->getThedate() . "," . $myschedule->getDay() . "," . $myschedule->getTimestart() . "-" . $myschedule->getTimeend(); $subject = "Tutor Session Cancelled: $messageshort"; $message="The following tutoring session was cancelled by $theuser: $messageshort " . getLocation($myschedule->getF2f()) . "," . getGroupCourses($myschedule->getGroupname()) . " for " . $myschedule->getSname(); // Determine who the tutor of this session was as this is who will receive the email: $tutor = getTutor($sid); $student=getStudentbyID($theuser); $temail = $tutor->getEmail(); $semail = $student->getEmail(); // Send email to Tutor // Removed email functionality for this demo } else { echo "

Based on the user response, the tutoring session was not cancelled.

"; echo "

Return to search

"; } } ?>

Demo/CancelSession.php

getTname() == $_SESSION['wsuser']) { $dtext= $schedule->getCourse() . "," . $schedule->getThedate() . "," . $schedule->getDay() . "," . $schedule->getTStart() . "-" . $schedule->getTend() . " with " . $schedule->getFirstname() . " " . $schedule->getLastname(); echo " "; // Display first part of the table echo "

Cancel Tutor Session Confirmation

"; echo "

"; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo ""; echo " "; echo " "; echo ""; echo ""; echo " "; echo ""; echo ""; echo "

"; // Send email to tutor about cancellation } else { echo "

You can only cancel sessions you created

"; } } else { echo "Someone might be trying to hack the system"; } }

Demo/createStudent.php

0 ) { echo "

"; echo "

Are you sure you want to cancel this session?
$dtext
    
"; echo "
"; echo "
"; echo "

Warning! Form Entry Errors Exist.

"; echo "
Please revise based on the following issues and submit again.
"; echo "
    "; foreach ($messages as $m) { echo "
    • $m
    "; } echo ""; echo "
"; echo ""; echo " "; echo "

"; } // Assign post values if exist $firstname=""; $lastname=""; $wsname=""; $email=""; if (isset($_POST["firstname"])) $firstname=check_input($_POST["firstname"]); if (isset($_POST["lastname"])) $lastname=check_input($_POST["lastname"]); if (isset($_POST["wsname"])) $wsname=check_input($_POST["wsname"]); if (isset($_POST["email"])) $email=check_input($_POST["email"]); echo "

"; echo "

Request Student Tutor Account

"; echo "

"; ?>

Complete the information in the form below and click Submit to create your account. All fields are required.
Firstname:
Lastname:
WebTycho username:
Email:
 
Welcome to the CS Tutor program! "; echo "

click here to login

"; } else { echo "

A student account with that WenTycho username already exists.

"; echo "

Please login using $wsname

"; } } } ?>

Demo/Deleteit.php

getThedate() . "," . $myschedule->getDay() . "," . $myschedule->getTimestart() . "-" . $myschedule->getTimeend(); $subject = "Tutor Session Deleted: $messageshort"; $message="The following tutoring session was deleted by $theuser: $messageshort " . getLocation($myschedule->getF2f()) . "," . getGroupCourses($myschedule->getGroupname()) . " for " . $myschedule->getSname(); // Determine who the tutor of this session was as this is who will receive the email: // Need to gather student data to send email $tutor = getTutor($sid); $temail=$tutor->getEmail(); // Double check to see if a student has already been scheduled $exists = checkReservation($sid); if($exists > 0) { // Get student email to send note of cancellation $mysched = getJoinStudent($sid); $semail = $mysched->getEmail(); $messages=$message . " Please visit the tutor site to select another available session."; // Delete the student schedule $rowsdeleted=cancelSession($sid); // Send email to Tutor and student about cancellation // removed for this app } // Send copy of cancellations to director $semail = "[email protected]"; // Delete the session $rowsdeleted=deleteSession($sid); // Echo successful response echo "

Thank you! The tutoring session has been Deleted.

"; echo "

Show all of my sessions

"; // Send email to Tutor // removed email functionality } else { echo "

Based on the user response, the tutoring session was not deleted.

"; echo "

Show all of my sessions

"; } } ?>

Demo/DeleteSession.php

getTname() == $_SESSION['wsuser']) { $dtext= getGroupCourses($schedule->getGroup()) . "," . $schedule->getThedate() . "," . $schedule->getDay() . "," . $schedule->getTStart() . "-" . $schedule->getTend() ; echo " "; // Display first part of the table echo "

Delete Tutor Session Confirmation

"; echo "

"; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo ""; echo " "; echo " "; echo ""; echo ""; echo " "; echo ""; echo ""; echo "

"; } else { echo "

You can only cancel sessions you own.

"; } } else { echo "Someone might be trying to hack the system"; } }

Demo/Images/Thumbs.db

Demo/Images/umuc_logo.jpg

Demo/Includes/Dbconnect.php

<?php // Location of the DBParms class require_once('Includes/DBObjects.php'); function connectdb() { // Get the DBParameters $mydbparms = getDbparms(); // Try to connect $mysqli = new mysqli($mydbparms->getHost(), $mydbparms->getUsername(), $mydbparms->getPassword(),$mydbparms->getDb()); if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } return $mysqli; } function getDbparms() { $trimmed = file('parms/dbparms.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $key = array(); $vals = array(); foreach($trimmed as $line) { $pairs = explode("=",$line); $key[] = $pairs[0]; $vals[] = $pairs[1]; } // Combine Key and values into an array $mypairs = array_combine($key,$vals); // Assign values to ParametersClass $myDbparms = new DbparmsClass($mypairs['username'],$mypairs['password'], $mypairs['host'],$mypairs['db']); // Display the Paramters values return $myDbparms; } ?>

Demo/Includes/DBObjects.php

<?php // Class to construct Database parameters with getters/setter class DBparmsClass { // property declaration private $username=""; private $password=""; private $host=""; private $db=""; // Constructor public function __construct($myusername,$mypassword,$myhost,$mydb) { $this->username = $myusername; $this->password = $mypassword; $this->host = $myhost; $this->db = $mydb; } // Get methods public function getUsername () { return $this->username; } public function getPassword () { return $this->password; } public function getHost () { return $this->host; } public function getDb () { return $this->db; } // Set methods public function setUsername ($myusername) { $this->username = $myusername; } public function setPassword ($mypassword) { $this->password = $mypassword; } public function setHost ($myhost) { $this->host = $myhost; } public function setDb ($mydb) { $this->db = $mydb; } } // End DBparms class ?>

Demo/Includes/FormObjects.php

<?php // Class to construct Students with getters/setter class StudentClass { // property declaration private $firstname=""; private $lastname=""; private $email=""; private $tychoname=""; // Constructor public function __construct($firstname,$lastname,$email,$tychoname) { $this->firstname = $firstname; $this->lastname = $lastname; $this->email = $email; $this->tychoname = $tychoname; } // Get methods public function getFirstname () { return $this->firstname; } public function getLastname () { return $this->lastname; } public function getEmail () { return $this->email; } public function getTychoname () { return $this->tychoname; } // Set methods public function setFirstname ($value) { $this->firstname = $value; } public function setLastname ($value) { $this->lastname = $value; } public function setEmail ($value) { $this->email = $value; } public function setTychoname ($value) { $this->tychoname = $value; } } // End Studentclass // Class to construct Tutor Join view with getters/setter class TutorJoinClass { // property declaration private $sid=""; private $firstname=""; private $lastname=""; private $email=""; private $tychoname=""; // Constructor public function __construct($sid,$tychoname,$firstname,$lastname,$email) { $this->sid = $sid; $this->tychoname = $tychoname; $this->firstname = $firstname; $this->lastname = $lastname; $this->email = $email; } // Get methods public function getSid () { return $this->sid; } public function getFirstname () { return $this->firstname; } public function getLastname () { return $this->lastname; } public function getEmail () { return $this->email; } public function getTychoname () { return $this->tychoname; } // Set methods public function setSid ($value) { $this->sid = $value; } public function setFirstname ($value) { $this->firstname = $value; } public function setLastname ($value) { $this->lastname = $value; } public function setEmail ($value) { $this->email = $value; } public function setTychoname ($value) { $this->tychoname = $value; } } // End TutorJoinclass // Class to construct ScheduleJoin data with getters/setter class ScheduleJoinClass { // property declaration private $scheduleid=""; private $thedate=""; private $day=""; private $timestart=""; private $timeend=""; private $groupname=""; private $f2f=""; private $sname=""; // Constructor public function __construct($scheduleid, $thedate,$day, $timestart, $timeend,$groupname,$f2f,$sname) { $this->scheduleid = $scheduleid; $this->thedate = $thedate; $this->day = $day; $this->timestart = $timestart; $this->timeend = $timeend; $this->groupname = $groupname; $this->f2f = $f2f; $this->sname = $sname; } // Get methods public function getScheduleid () { return $this->scheduleid; } public function getThedate () { return $this->thedate; } public function getDay () { return $this->day; } public function getTimestart () { return $this->timestart; } public function getTimeend () { return $this->timeend; } public function getGroupname () { return $this->groupname; } public function getF2f () { return $this->f2f; } public function getSname () { return $this->sname; } // Set methods public function setScheduleid ($value) { $this->scheduleid = $value; } public function setThedate ($value) { $this->thedate = $value; } public function setDay ($value) { $this->day = $value; } public function setTimestart ($value) { $this->timestart = $value; } public function setTimeend ($value) { $this->timeend = $value; } public function setGroupname ($value) { $this->groupname = $value; } public function setF2f ($value) { $this->f2f = $value; } public function setSname ($value) { $this->sname = $value; } } // End ScheduleJoinClass // Class to construct Students with getters/setter class TutorClass { // property declaration private $firstname=""; private $lastname=""; private $email=""; private $tychoname=""; private $f2f=""; // Constructor public function __construct($firstname,$lastname,$email,$tychoname,$f2f) { $this->firstname = $firstname; $this->lastname = $lastname; $this->email = $email; $this->tychoname = $tychoname; $this->f2f = $f2f; } // Get methods public function getFirstname () { return $this->firstname; } public function getLastname () { return $this->lastname; } public function getEmail () { return $this->email; } public function getTychoname () { return $this->tychoname; } public function getF2f () { return $this->f2f; } // Set methods public function setFirstname ($value) { $this->firstname = $value; } public function setLastname ($value) { $this->lastname = $value; } public function setEmail ($value) { $this->email = $value; } public function setTychoname ($value) { $this->tychoname = $value; } public function setF2f ($value) { $this->f2f = $value; } } // End Tutorclass // Class to construct Tutor Schedule View with getters/setter class TutorViewClass { // property declaration private $id = ""; private $thedate = ""; private $day = ""; private $tstart = ""; private $tend = ""; private $f2f = ""; private $sname = ""; private $tname = ""; private $help = ""; private $course = ""; private $firstname = ""; private $lastname = ""; private $email = ""; // Constructor public function __construct($id,$thedate,$day,$tstart,$tend,$f2f, $sname,$tname,$help,$course,$firstname,$lastname,$email) { $this->id = $id; $this->thedate = $thedate; $this->day = $day; $this->tstart = $tstart; $this->tend = $tend; $this->f2f = $f2f; $this->sname = $sname; $this->tname = $tname; $this->help = $help; $this->course = $course; $this->firstname = $firstname; $this->lastname = $lastname; $this->email = $email; } // Get methods public function getID () { return $this->id; } public function getThedate () { return $this->thedate; } public function getDay () { return $this->day; } public function getTstart () { return $this->tstart; } public function getTend () { return $this->tend; } public function getF2f () { return $this->f2f; } public function getSname () { return $this->sname; } public function getTname () { return $this->tname; } public function getHelp () { return $this->help; } public function getCourse () { return $this->course; } public function getFirstname () { return $this->firstname; } public function getLastname () { return $this->lastname; } public function getEmail () { return $this->email; } // Set methods public function setID ($value) { $this->id = $value; } public function setThedate ($value) { $this->thedate = $value; } public function setDay ($value) { $this->day = $value; } public function setTstart ($value) { $this->tstart = $value; } public function setTend ($value) { $this->tend = $value; } public function setF2f ($value) { $this->f2f = $value; } public function setSname ($value) { $this->sname = $value; } public function setTname ($value) { $this->tname = $value; } public function setHelp ($value) { $this->help = $value; } public function setCourse ($value) { $this->course = $value; } public function setFirstname ($value) { $this->firstname = $value; } public function setLastname ($value) { $this->lastname = $value; } public function setEmail ($value) { $this->email = $value; } } // End TutorViewclass // Class to construct Tutor Cancel View with getters/setter class TutorCancelClass { // property declaration private $id = ""; private $thedate = ""; private $day = ""; private $tstart = ""; private $tend = ""; private $group = ""; private $f2f = ""; private $sname = ""; private $tname = ""; // Constructor public function __construct($id,$thedate,$day,$tstart,$tend,$group,$f2f,$sname,$tname) { $this->id = $id; $this->thedate = $thedate; $this->day = $day; $this->tstart = $tstart; $this->tend = $tend; $this->group = $group; $this->f2f = $f2f; $this->sname = $sname; $this->tname = $tname; } // Get methods public function getID () { return $this->id; } public function getThedate () { return $this->thedate; } public function getDay () { return $this->day; } public function getTstart () { return $this->tstart; } public function getTend () { return $this->tend; } public function getGroup () { return $this->group; } public function getF2f () { return $this->f2f; } public function getSname () { return $this->sname; } public function getTname () { return $this->tname; } // Set methods public function setID ($value) { $this->id = $value; } public function setThedate ($value) { $this->thedate = $value; } public function setDay ($value) { $this->day = $value; } public function setTstart ($value) { $this->tstart = $value; } public function setTend ($value) { $this->tend = $value; } public function setGroup ($value) { $this->group = $value; } public function setF2f ($value) { $this->f2f = $value; } public function setSname ($value) { $this->sname = $value; } public function setTname ($value) { $this->tname = $value; } } // End TutorCancelclass // Class to construct Student Schedule View with getters/setter class StudentViewClass { // property declaration private $id = ""; private $thedate = ""; private $day = ""; private $tstart = ""; private $tend = ""; private $tname = ""; private $f2f = ""; private $help = ""; private $course = ""; private $registerdate = ""; private $firstname = ""; private $lastname = ""; private $email = ""; // Constructor public function __construct($id,$thedate,$day,$tstart,$tend,$tname,$f2f, $help,$course,$registerdate,$firstname,$lastname,$email) { $this->id = $id; $this->thedate = $thedate; $this->day = $day; $this->tstart = $tstart; $this->tend = $tend; $this->tname = $tname; $this->f2f = $f2f; $this->help = $help; $this->course = $course; $this->registerdate = $registerdate; $this->firstname = $firstname; $this->lastname = $lastname; $this->email = $email; } // Get methods public function getID () { return $this->id; } public function getThedate () { return $this->thedate; } public function getDay () { return $this->day; } public function getTstart () { return $this->tstart; } public function getTend () { return $this->tend; } public function getF2f () { return $this->f2f; } public function getTname () { return $this->tname; } public function getHelp () { return $this->help; } public function getCourse () { return $this->course; } public function getRegisterdate () { return $this->registerdate; } public function getFirstname () { return $this->firstname; } public function getLastname () { return $this->lastname; } public function getEmail () { return $this->email; } // Set methods public function setID ($value) { $this->id = $value; } public function setThedate ($value) { $this->thedate = $value; } public function setDay ($value) { $this->day = $value; } public function setTstart ($value) { $this->tstart = $value; } public function setTend ($value) { $this->tend = $value; } public function setF2f ($value) { $this->f2f = $value; } public function setTname ($value) { $this->tname = $value; } public function setHelp ($value) { $this->help = $value; } public function setCourse ($value) { $this->course = $value; } public function setRegisterdate ($value) { $this->course = $registerdate; } public function setFirstname ($value) { $this->firstname = $value; } public function setLastname ($value) { $this->lastname = $value; } public function setEmail ($value) { $this->email = $value; } } // End StudentViewclass // Class to construct StudentSchedule Class with getters/setter class StudentScheduleClass { // property declaration private $id = ""; private $tycho = ""; private $help = ""; private $course = ""; private $register = ""; // Constructor public function __construct($id,$tycho,$help,$course,$register) { $this->id = $id; $this->tycho = $tycho; $this->help = $help; $this->course = $course; $this->register = $register; } // Get methods public function getID () { return $this->id; } public function getTycho () { return $this->tycho; } public function getHelp () { return $this->help; } public function getCourse () { return $this->course; } public function getRegister () { return $this->register; } // Set methods public function setID ($value) { $this->id = $value; } public function setTycho ($value) { $this->tycho = $value; } public function setHelp ($value) { $this->help = $value; } public function setCourse ($value) { $this->course = $value; } public function setRegister ($value) { $this->register = $value; } } // End StudentScheduleclass // Class to construct StudentJoin Class with getters/setter class StudentJoinClass { // property declaration private $id = ""; private $tycho = ""; private $help = ""; private $course = ""; private $register = ""; private $email = ""; // Constructor public function __construct($id,$tycho,$help,$course,$register,$email) { $this->id = $id; $this->tycho = $tycho; $this->help = $help; $this->course = $course; $this->register = $register; $this->email = $email; } // Get methods public function getID () { return $this->id; } public function getTycho () { return $this->tycho; } public function getHelp () { return $this->help; } public function getCourse () { return $this->course; } public function getRegister () { return $this->register; } public function getEmail () { return $this->email; } // Set methods public function setID ($value) { $this->id = $value; } public function setTycho ($value) { $this->tycho = $value; } public function setHelp ($value) { $this->help = $value; } public function setCourse ($value) { $this->course = $value; } public function setRegister ($value) { $this->register = $value; } public function setEmail ($value) { $this->email = $value; } } // End StudentScheduleclass // Email parameters class class EmailparmsClass { // property declaration private $smtphost = ""; private $smtpport = 0; private $smtpauth = false; private $smtpuser = ""; private $smtppass= ""; private $smtpfrom=""; // Constructor public function __construct($mysmtphost,$mysmtpport,$mysmtpauth,$mysmtpuser, $mysmtppass,$mysmtpfrom) { $this->smtphost = $mysmtphost; $this->smtpport = $mysmtpport; $this->smtpauth = $mysmtpauth; $this->smtpuser = $mysmtpuser; $this->smtppass = $mysmtppass; $this->smtpfrom = $mysmtpfrom; } // Get methods public function getsmtphost () { return $this->smtphost; } public function getsmtpport () { return $this->smtpport; } public function getsmtpauth () { return $this->smtpauth; } public function getsmtpuser () { return $this->smtpuser; } public function getsmtppass () { return $this->smtppass; } public function getsmtpfrom () { return $this->smtpfrom; } // Set methods public function setsmtphost ($smtphost) { $this->smtphost = $smtphost; } public function setsmtpport ($smtpport) { $this->smtpport = $smtpport; } public function setsmtpauth ($smtpauth) { $this->smtpauth = $smtpauth; } public function setsmtpuser ($smtpuser) { $this->smtpuser = $smtpuser; } public function setsmtppass ($smtppass) { $this->smtppass = $smtppass; } public function setsmtpfrom ($smtpfrom) { $this->smtpfrom = $smtpfrom; } } // End Emailparms class ?>

Demo/Includes/Header.php

<?php // This provides the header displayed on all Pages ?> <DIV> <table id="myheader"> <tbody> <tr> <td><img src="Images/umuc_logo.jpg" alt="UMUC logo"/></td> <td>CS Tutor</td> </tr> </tbody> </table> </DIV> <?php ?>

Demo/Includes/SQLFunctions.php

<?php // Include the required DBConnection information require_once('Includes/Dbconnect.php'); // Include the Faculty999Class definition require_once('Includes/FormObjects.php'); function getStudent($tname,$em) { // Init values to "" $firstname=""; $lastname=""; $email=""; $tychoname=""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "SELECT firstName, lastName, eMail, tychoName from Students where tychoName='$tname' and eMail='$em'"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $firstname=$row["firstName"]; $lastname = $row["lastName"]; $email=$row["eMail"]; $tychoname = $row["tychoName"]; } $myStudent = new StudentClass($firstname,$lastname,$email,$tychoname); /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $myStudent; } function countStudent ($student) { // Connect to the database $mysqli = connectdb(); $firstname = $student->getFirstname(); $lastname = $student->getLastname(); $wsname = $student->getTychoname(); $email = $student->getEmail(); // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "SELECT count(*) as count from Students where tychoName='$wsname'"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $count=$row["count"]; } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $count; } function insertStudent ($student) { // Connect to the database $mysqli = connectdb(); $firstname = $student->getFirstname(); $lastname = $student->getLastname(); $wsname = $student->getTychoname(); $email = $student->getEmail(); // Now we can insert $Query = "INSERT INTO Students (firstName,lastName,eMail,tychoName) VALUES ('$firstname', '$lastname', '$email', '$wsname')"; $Success=false; if ($result = $mysqli->query($Query)) { $Success=true; } $mysqli->close(); return $Success; } function getSchedules($f2f,$area,$num) { $mySchedule = array(); // Need to get the group for this course $groupname = getGroupname($area,$num); // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "SELECT scheduleID,thedate,day,timeStart,timeEnd,groupName,f2f,sName from GroupSchedules where (thedate between CURDATE() and DATE_ADD(CURDATE(), INTERVAL 14 DAY) and f2f='$f2f' and GroupName='$groupname') and scheduleID NOT IN (select scheduleID from StudentSchedules)"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $scheduleid=$row["scheduleID"]; $thedate = $row["thedate"]; $day=$row["day"]; $timestart = $row["timeStart"]; $timeend = $row["timeEnd"]; $groupname = $row["groupName"]; $f2f = $row["f2f"]; $sname = $row["sName"]; $mySchedule[] = new ScheduleJoinClass($scheduleid,$thedate,$day,$timestart,$timeend,$groupname,$f2f,$sname); } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mySchedule; } function getCourselist($groupname) { $mycourses = ""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive // Changed to CourseGroups2 $Myquery = "SELECT courseDisc,courseNum from CourseGroups where groupname='$groupname'"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $coursedisc=$row["courseDisc"]; $coursenum = $row["courseNum"]; $mycourses = $mycourses . $coursedisc . $coursenum . "<br>"; } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mycourses; } // Returns Array of Courses function getCourses() { $mycourses = array(); // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "SELECT courseDisc,courseNum,courseTitle from Courses"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $coursedisc=$row["courseDisc"]; $coursenum = $row["courseNum"]; $coursetitle = $row["courseTitle"]; $mycourses[] = $coursedisc . $coursenum . "-" . $coursetitle; } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mycourses; } function getGroupname($area,$num) { $groupname=""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "SELECT groupName from CourseGroups where courseDisc='$area' and courseNum='$num'"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $groupname = $row["groupName"]; } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $groupname; } function getSchedulebyID($id) { $mySchedule = ""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "SELECT scheduleID,thedate,day,timeStart,timeEnd,groupName,f2f,sName from GroupSchedules where scheduleID = '$id'"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $scheduleid=$row["scheduleID"]; $thedate = $row["thedate"]; $day=$row["day"]; $timestart = $row["timeStart"]; $timeend = $row["timeEnd"]; $groupname = $row["groupName"]; $f2f = $row["f2f"]; $sname = $row["sName"]; $mySchedule = new ScheduleJoinClass($scheduleid,$thedate,$day,$timestart,$timeend,$groupname,$f2f,$sname); } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mySchedule; } function getTutorbyID($id) { $mytutor = ""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "SELECT firstName,lastName,eMail,tychoName,f2f from Tutors where tychoName = (select tychoName from TutorSchedules where scheduleID = '$id')"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $firstname=$row["firstName"]; $lastname = $row["lastName"]; $email=$row["eMail"]; $tychoname = $row["tychoName"]; $f2f = $row["f2f"]; $mytutor = new TutorClass($firstname,$lastname,$email,$tychoname,$f2f); } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mytutor; } function getStudentbyID($tname) { // Init values to "" $firstname=""; $lastname=""; $email=""; $tychoname=""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "SELECT firstName, lastName, eMail, tychoName from Students where tychoName='$tname'"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $firstname=$row["firstName"]; $lastname = $row["lastName"]; $email=$row["eMail"]; $tychoname = $row["tychoName"]; } $myStudent = new StudentClass($firstname,$lastname,$email,$tychoname); /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $myStudent; } // Method to see if the session has already been taken function checkReservation($id) { $mycount = 0; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "SELECT count(*) thecount from StudentSchedules where scheduleID = '$id'"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $mycount = $row["thecount"]; } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mycount; } // Method to see if the session has already been taken function getJoinStudent($id) { $myjoin = ""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "select scheduleID, a.tychoName, helpDescription, courseInfo, RegisterDate , email from StudentSchedules a, Students b where a.tychoName = b.tychoName and scheduleID = $id"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $sid = $row["scheduleID"]; $tychoname = $row["tychoName"]; $help = $row["helpDescription"]; $course = $row["courseInfo"]; $rdate = $row["RegisterDate"]; $email = $row["email"]; } $myjoin = new StudentJoinClass ($sid,$tychoname,$help,$course,$rdate,$email); /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $myjoin; } function reserveSession ($id,$tname,$course,$help,$today) { // Check that $help is less than 255 characters. $helplen = strlen($help); if ($helplen >255) { $help=substr($help,0,254); } // Connect to the database $mysqli = connectdb(); // Remove potential user entered quotes and such so we can save in the database $help = $mysqli->real_escape_string($help); // Now we can insert $Query = "INSERT INTO StudentSchedules VALUES ('$id', '$tname', '$help', '$course','$today')"; $Success=false; if ($result = $mysqli->query($Query)) { $Success=true; } $mysqli->close(); return $Success; } function findTutor($tname,$pass) { // Init count to 0 $count=0; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "SELECT count(*) cnt from TutorDetails where tychoName='$tname' and password='$pass'"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $count=$row["cnt"]; } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $count; } // Retrieves tutors schedule between today and the next 14 days function getTutorSchedule($tychoname) { $mySchedule = array(); // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "Select scheduleID from GroupSchedules where scheduleID IN (select scheduleID from StudentSchedules) and scheduleID IN (select scheduleID from TutorSchedules where tychoName = '$tychoname') and thedate between CURDATE() and DATE_ADD(CURDATE(), INTERVAL 14 DAY)"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $mySchedule[]=$row["scheduleID"]; } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mySchedule; } // Retrieves tutors schedule for a specific id function getTutorSchedulebyID($id) { $mySchedule = array(); // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "Select a.scheduleID, thedate, day, timeStart, timeEnd, groupName, f2f, sName,tychoName from TutorSchedules a, GroupSchedules b where a.scheduleID = $id and a.scheduleID=b.scheduleID"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $id = $row["scheduleID"]; $thedate = $row["thedate"]; $day = $row["day"]; $tstart = $row["timeStart"]; $tend = $row["timeEnd"]; $group = $row["groupName"]; $f2f = $row["f2f"]; $sname = $row["sName"]; $tname = $row["tychoName"]; $mySchedule = new TutorCancelClass($id,$thedate,$day,$tstart,$tend,$group,$f2f,$sname,$tname); } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mySchedule; } // Retrieves tutors schedule for a specific ID function getTutorview($id) { $mySchedule = ""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "Select a.scheduleID, thedate,day, timeStart,timeEnd,f2f,sName, b.tychoName, helpDescription, courseInfo, RegisterDate, firstName, lastName, eMail from GroupSchedules a, StudentSchedules b, Students c where a.scheduleID = b.scheduleID and b.tychoName = c.tychoName and a.scheduleID = '$id' order by thedate,timeStart"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $id = $row["scheduleID"]; $thedate = $row["thedate"]; $day = $row["day"]; $tstart = $row["timeStart"]; $tend = $row["timeEnd"]; $f2f = $row["f2f"]; $sname = $row["sName"]; $tname = $row["tychoName"]; $help = $row["helpDescription"]; $course = $row["courseInfo"]; $firstname = $row["firstName"]; $lastname = $row["lastName"]; $email = $row["eMail"]; // Make this an Object $mySchedule = new TutorViewClass($id,$thedate,$day,$tstart,$tend,$f2f, $sname,$tname,$help,$course,$firstname,$lastname,$email); } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mySchedule; } // Retrieves tutors schedule between today and the next 14 days function getStudentview($tycho) { $mySchedule = array(); // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "select a.scheduleID,thedate,day,timeStart,timeEnd,a.tychoName,b.f2f, helpDescription,courseInfo,RegisterDate,d.firstName,d.lastName,d.eMail from StudentSchedules a, GroupSchedules b, TutorSchedules c, Tutors d where a.tychoName = '$tycho' and a.scheduleID = b.scheduleID and a.scheduleID = c.scheduleID and c.tychoName = d.tychoName order by thedate,timeStart"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $id = $row["scheduleID"]; $thedate = $row["thedate"]; $day = $row["day"]; $tstart = $row["timeStart"]; $tend = $row["timeEnd"]; $tname = $row["tychoName"]; $f2f = $row["f2f"]; $help = $row["helpDescription"]; $course = $row["courseInfo"]; $registerdate = $row["RegisterDate"]; $firstname = $row["firstName"]; $lastname = $row["lastName"]; $email = $row["eMail"]; // Make this an Object $mySchedule[] = new StudentViewClass($id,$thedate,$day,$tstart,$tend,$tname,$f2f, $help,$course,$registerdate,$firstname,$lastname,$email); } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mySchedule; } function getStudentSchedule($id) { $mySchedule = ""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "select a.scheduleID,thedate,day,timeStart,timeEnd,a.tychoName,b.f2f, helpDescription,courseInfo,RegisterDate,d.firstName,d.lastName,d.eMail from StudentSchedules a, GroupSchedules b, TutorSchedules c, Tutors d where a.scheduleID = b.scheduleID and a.scheduleID = c.scheduleID and c.tychoName = d.tychoName and a.scheduleID=$id order by thedate,timeStart"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $id = $row["scheduleID"]; $thedate = $row["thedate"]; $day = $row["day"]; $tstart = $row["timeStart"]; $tend = $row["timeEnd"]; $tname = $row["tychoName"]; $f2f = $row["f2f"]; $help = $row["helpDescription"]; $course = $row["courseInfo"]; $registerdate = $row["RegisterDate"]; $firstname = $row["firstName"]; $lastname = $row["lastName"]; $email = $row["eMail"]; // Make this an Object $mySchedule = new StudentViewClass($id,$thedate,$day,$tstart,$tend,$tname,$f2f, $help,$course,$registerdate,$firstname,$lastname,$email); } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mySchedule; } // Cancels an existing session function cancelSession($id) { $rowdeleted=0; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "delete from StudentSchedules where scheduleID = $id"; $mysqli->query($Myquery); $rowsdeleted=$mysqli->affected_rows; $mysqli->close(); return $rowsdeleted; } // deletes an existing session function deleteSession($id) { $rowdeleted=0; // Connect to the database $mysqli = connectdb(); // Define the first Query $Myquery = "delete from TutorSchedules where scheduleID = $id"; $mysqli->query($Myquery); $rowsdeleted=$mysqli->affected_rows; // Need to delete from Student schedules if it has been assigned and send a cancelation email // Define the second query $Myquery = "delete from GroupSchedules where scheduleID = $id"; $mysqli->query($Myquery); $rowsdeleted=$mysqli->affected_rows; $mysqli->close(); return $rowsdeleted; } function getGroupSchedule($id) { $mySchedule = ""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "select scheduleID,thedate,day,timeStart,timeEnd,groupName,f2f,sName from GroupSchedules where scheduleID=$id"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $id = $row["scheduleID"]; $thedate = $row["thedate"]; $day = $row["day"]; $tstart = $row["timeStart"]; $tend = $row["timeEnd"]; $groupname = $row["groupName"]; $f2f = $row["f2f"]; $sname = $row["sName"]; // Make this an Object $mySchedule = new ScheduleJoinClass($id,$thedate,$day,$tstart,$tend,$groupname,$f2f, $sname); } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mySchedule; } function getGroupSchedulebyTutor($tutor,$semester) { $mySchedule = array(); // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "Select scheduleID,thedate,day,timeStart,timeEnd,groupName,f2f,sName from GroupSchedules where scheduleID IN (select scheduleID from TutorSchedules where tychoName = '$tutor') and sName = '$semester'"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $id = $row["scheduleID"]; $thedate = $row["thedate"]; $day = $row["day"]; $tstart = $row["timeStart"]; $tend = $row["timeEnd"]; $groupname = $row["groupName"]; $f2f = $row["f2f"]; $sname = $row["sName"]; // Make this an Object $mySchedule[] = new ScheduleJoinClass($id,$thedate,$day,$tstart,$tend,$groupname,$f2f,$sname); } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mySchedule; } function getTutor($id) { $mytutor = ""; // Connect to the database $mysqli = connectdb(); // Define the Query // For Windows MYSQL String is case insensitive $Myquery = "select scheduleID, a.tychoName, firstName, lastName, eMail from TutorSchedules a, Tutors b where a.tychoName = b.tychoName and a.scheduleID = $id;"; if ($result = $mysqli->query($Myquery)) { /* Fetch the results of the query */ while( $row = $result->fetch_assoc() ) { $id = $row["scheduleID"]; $tycho = $row["tychoName"]; $firstname = $row["firstName"]; $lastname = $row["lastName"]; $email = $row["eMail"]; // Make this an Object $mytutor = new TutorJoinClass($id,$tycho,$firstname,$lastname,$email); } /* Destroy the result set and free the memory used for it */ $result->close(); } $mysqli->close(); return $mytutor; } ?>

Demo/Includes/Utils.php

<?php function check_input($data) { global $ret_data; $data = trim($data); $ret_data = htmlspecialchars($data); return $ret_data; } function getLocation($data) { $ret_data="Online"; if ($data=="Y") $ret_data = "F2F (Largo, MD)"; return $ret_data; } // Look-up for the Group Letter function getGroupCourses($group) { $value=""; switch ($group) { case 'A': $value="CMIS102"; break; case 'B': $value="CMIS141,CMIS242,CMSC350"; break; case 'C': $value="CMIS125"; break; case 'D': $value="CMIS310,CMIS325"; break; break; case 'E': $value="CMIS170,CMIS320"; break; case 'F': $value="CMSC150"; break; case 'G': $value="IFSM201"; break; } return $value; } function getEmailparms() { require_once('Includes/FormObjects.php'); $trimmed = file('parms/emailparms.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $key = array(); $vals = array(); foreach($trimmed as $line) { $pairs = explode("=",$line); $key[] = $pairs[0]; $vals[] = $pairs[1]; } // Combine Key and values into an array $mypairs = array_combine($key,$vals); // Assign values to ParametersClass $myEmailparms = new EmailparmsClass($mypairs['smtphost'],$mypairs['smtpport'], $mypairs['smtpauth'],$mypairs['smtpuser'], $mypairs['smtppass'],$mypairs['smtpfrom']); // Display the Paramters values return $myEmailparms; } ?>

Demo/index.html

Are you sure you want to permanently delete this session?
$dtext
    
UMUC logo CS Tutor

Welcome to the CMIS and CMSC Tutor Request Site

If you have already created an account, sign in using your WebTycho username and email address in the form below.
Sign in to your CSTutor Account:
WebTycho username:
email address:
 
First time users need to create an account by clicking on the link below.

Create a new CSTutor Account

Demo/ListSessions.php

0 ) { echo "

"; echo "

You currently have a total of $sessioncnt tutoring sessions for $currentsem as shown below.
"; echo "
To permanently Delete a session click on the Delete button. Deletions should only be for emergency situations.
"; echo "
Once a session is deleted, no students can sign up for this session.
"; echo ""; echo " "; echo "
"; echo "
Session ID
"; echo "
Date
"; echo "
Day
"; echo "
Times
"; echo "
Course(s)
"; echo "
Location
"; echo "
Semester
"; echo "
Delete?
"; echo ""; foreach ($allschedule as $s) { // Extract the data $sid = $s->getScheduleid(); $thedate = $s->getThedate(); $day = $s->getDay(); $tstart = $s->getTimestart(); $tend = $s->getTimeend(); $group = $s->getGroupname(); $f2f = $s->getF2f(); $sname = $s->getSname(); echo "
"; echo "
$sid
"; echo "
$thedate
"; echo "
$day
"; echo "
$tstart-$tend
"; echo "
" . getGroupCourses($group). "
"; echo "
" . getLocation($f2f). "
"; echo "
$sname
"; echo "
Delete Session?
"; echo ""; } echo ""; } } ?>

Demo/logs/logdata.txt

S3: Reservation success from 6, jrobertson1, CMIS102 on April 18, 2015, 9:57 am was 1 S4: Reservation Email sent to [email protected], [email protected] on April 18, 2015, 9:57 am was S3: Reservation success from 31, jrobertson1, CMIS102 on April 18, 2015, 9:58 am was 1 S4: Reservation Email sent to [email protected], [email protected] on April 18, 2015, 9:58 am was S3: Reservation success from 10, jrobertson1, CMIS141 on April 18, 2015, 10:04 am was 1 S4: Reservation Email sent to [email protected], [email protected] on April 18, 2015, 10:04 am was S3: Reservation success from 14, jrobertson1, CMIS242 on April 18, 2015, 10:04 am was 1 S4: Reservation Email sent to [email protected], [email protected] on April 18, 2015, 10:04 am was S3: Reservation success from 8, jrobertson1, CMIS102 on April 18, 2015, 10:04 am was 1 S4: Reservation Email sent to [email protected], [email protected] on April 18, 2015, 10:04 am was

Demo/parms/dbparms.txt

username=sdev_owner password=sdev300 host=localhost db=sdev

Demo/parms/emailparms.txt

smtphost=yourmailserverhere smtpport=25 smtpauth=false smtpuser="" smtppass="" [email protected]

Demo/SearchSessions.php

0) { echo "
Welcome! You have the following history of tutoring sessions:
"; // Display table echo "

Tutor Session History

"; echo " "; // Display first part of the table echo "

"; echo ""; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo ""; foreach ($mysessions as $m) { // Extract the data $id = $m->getID(); $thedate = $m->getThedate(); $day = $m->getDay(); $tstart = $m->getTstart(); $tend = $m->getTend(); $f2f = getLocation($m->getF2f()); $tname = $m->getTname(); $help = $m->getHelp(); $course = $m->getCourse(); $firstname = $m->getFirstname(); $lastname = $m->getLastname(); $email = $m->getEmail(); echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo ""; } // End the table echo " "; echo ""; echo ""; echo "

"; } } // End Show form function show_form() { // Call Function to retrieve available courses $courses = getCourses(); echo "

Select the course and the format you prefer for your tutoring session and then click Search.
"; echo "
If a course is not listed, tutoring is not currently available for that course.
"; // Display table echo "

Search Tutor Sessions

"; echo " "; // Display first part of the table echo "

"; echo ""; echo "

CourseDateTimeTutoring LocationHelp RequestedTutorCancel Session?
$course$thedate, $day $tstart-$tend$f2f$help$firstname $lastname ($email) Cancel Session $id?
"; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo "
Course: "; echo "Select Course "; foreach ($courses as $c) { // Display the information in the table echo "$c "; } echo "
Format: "; echo "Select Format "; echo "Online via Wimba "; echo "Face-to-Face at Largo, MD "; echo "
"; echo ""; // End the table echo " "; echo ""; echo ""; echo "

"; } // End Show form ?>

Demo/ShowSessions.php

0 && strlen($format)>0 ) { // Break out Subject and Course $areaname=substr($course,0,4); $coursenum=substr($course,4,3); $coursedata=$areaname.$coursenum; $schedflag='N'; if ($format=='f2f') $schedflag='Y'; // Call Function to retrieve available tutor slots over next two weeks $theSchedule = getSchedules($schedflag,$areaname,$coursenum); $sessioncnt = count($theSchedule); if ($sessioncnt > 0) { echo "
Select an available tutoring session from the dates and times listed below by clicking the radio button in the corresponding row.
"; echo "
Then enter the topics/assignment you would like tutoring assistance and click Submit.
Sessions available over the next 2 weeks are displayed.
Note: All students must register for a specific tutoring session to be eligible for tutoring.
"; //if ($sessioncnt > 0) //{ // Display table echo "

Tutoring Sessions Matching your Search Criteria ($sessioncnt)

"; echo " "; // Display first part of the table echo "

"; echo ""; echo " "; echo " "; echo " "; echo " "; echo ""; // Display the report foreach ($theSchedule as $sched) { // Extract the data $myid=$sched->getScheduleid(); $mydate=$sched->getThedate(); $myday=$sched->getDay(); $mystart=$sched->getTimestart(); $myend=$sched->getTimeend(); $mycoursegroup=$sched->getGroupname(); // Call the function to retrieve Course list $coursenames = getCourselist($mycoursegroup); // Display the information in the table echo " "; echo " "; echo " "; echo ""; } echo " "; echo " "; echo " "; echo "

Course(s)Select Day and Time
$coursenames$mydate,$myday $mystart-$myend
Describe the topic assignment or other activity you would like help with."; echo ""; echo ""; // End the table echo "
"; echo ""; echo ""; echo ""; echo "

"; } else { echo "

Sorry. No $format tutor sessions are available for $course, over the next 2 weeks.

"; echo "

Return to search

"; } } else { echo "

No Course or Format search criteria were selected. Return to search

"; } } // End Show form function validate_form() { require_once('Includes/Utils.php'); require_once('Includes/FormObjects.php'); require_once('Includes/SQLFunctions.php'); // Set the Date stamp date_default_timezone_set('America/New_York'); $today = date("F j, Y, g:i a"); // Show the page header include('Includes/Header.php'); // Assign values $scheduleid = check_input($_POST["scheduleid"]); $coursesave = check_input($_POST["courseinfo"]); $helpdesc = check_input($_POST["helpdesc"]); // Just check for null values and email format if (strlen($scheduleid)==0) { echo "

No tutor session was selected. Return to search to start over.

"; } else { // Retrieve the Session Information $myname = $_SESSION['wsuser']; if (strlen($myname) > 0) { // Make sure the time/date is still available $isReserved = checkReservation($scheduleid); // If available make the reservation and send the success message if ($isReserved==0) { // Insert the reservation $success = reserveSession($scheduleid,$myname,$coursesave,$helpdesc,$today); $STDOUT = fopen('logs/logdata.txt', 'a'); fwrite($STDOUT,"S3: Reservation success from $scheduleid, $myname, $coursesave on $today was $success\n"); fclose($STDOUT); // Display the results // Retrieve the session information and ask for them to print for their records. $theschedule = getSchedulebyID($scheduleid); // Retrieve the tutor information $thetutor = getTutorbyID($scheduleid); // Retrieve the Student information $thestudent = getStudentbyID($myname); // Logic for determining the session code and URLs (Probably should be in database also // Get the Day and GroupName $cday=$theschedule->getDay(); $cgroup=$theschedule->getGroupName(); $ctime=$theschedule->getTimestart(); // Sunday CMIS102 9AM - 1PM if ($cday=="Sunday" && $cgroup=="A" && $ctime >=900 && $ctime =900 && $ctime =900 && $ctime =1800 && $ctime =1800 && $ctime =1800 && $ctime =1800 && $ctime =1800 && $ctime =900 && $ctime =900 && $ctime getF2f()=='Y') $theformat = 'Face-to-Face at Largo, MD'; $emailstring = "Congratulations $myname you have successfully signed up for the following tutoring session!" ." "; $emailstring .= "\nStudent name:" .$thestudent->getFirstname(). " " .$thestudent->getLastname() . " "; $emailstring .= "Student email:" .$thestudent->getEmail() . " "; $emailstring .= "Session Date:" .$theschedule->getThedate() . " "; $emailstring .= "Day:" .$theschedule->getDay() . " "; $emailstring .= "Start time:" .$theschedule->getTimestart()." "; $emailstring .= "Stop time:" .$theschedule->getTimeend()." "; $emailstring .= "Format: $theformat "; $emailstring .= "Semester:" .$theschedule->getSname()." "; $emailstring .="Tutor name:".$thetutor->getFirstname(). " " .$thetutor->getLastname()." "; $emailstring .= "Tutor email:" .$thetutor->getEmail()." "; if ($theschedule->getF2f()=='N'){ $emailstring .= "WebEx URL: $sessionURL" ." "; $emailstring .= "WebEx Phone Dial In Number: $phoneIN" ." "; $emailstring .= "WebEx Access Code: $accessCode" ." "; $emailstring .= "Date Reservation submitted:$today" ." "; } $emailstring .= "Note the following details about tutoring sessions: "; $emailstring .= "F2F tutoring sessions occur in the student lounge area at the Largo Center (1616 McCormick Drive Largo MD 20774) "; $emailstring .= "Online tutoring sessions occur through WebEx. "; // Also put the contact/information echo "
Congratulations $myname you have successfully signed up for the following tutoring session!
"; // Display first part of the table echo "

"; echo ""; echo " "; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; if ($theschedule->getF2f()=='N'){ echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; echo " "; echo " "; echo " "; echo ""; } echo " "; echo " "; echo " "; echo ""; echo ""; echo ""; echo "

"; echo "

Please print for your records. An email is also being sent to your email address of " .$thestudent->getEmail() . "
"; echo "
Note the following details about tutoring sessions: "; echo "
  1. F2F tutoring sessions occur in the student lounge area at the Largo Center (1616 McCormick Drive Largo MD 20774)
"; echo "
  • Online tutoring sessions occur through WebEx
"; echo " "; // Send the email to tutor and student // Send email to Tutor $subject = "Tutor Session Confirmation"; $temail = $thetutor->getEmail(); $semail=$thestudent->getEmail(); // Removed email // Log email being sent $STDOUT = fopen('logs/logdata.txt', 'a'); fwrite($STDOUT,"S4: Reservation Email sent to $semail, $temail on $today was $ret\n"); fclose($STDOUT); } else { // Log Error being sent $STDOUT = fopen('logs/logdata.txt', 'a'); fwrite($STDOUT,"S5: Session, $scheduleID was not saved by $myname on $today\n"); fclose($STDOUT); echo "

Oops! There was an error in saving your request.

"; echo "

Most likely your session has timed out, or someone else has reserved the time you wanted. Please try again.

"; echo "Add another Tutoring Session"; } echo "

"; echo "Add another Tutoring Session"; } } } ?>

Demo/tauthcheck.php

FieldValue
Course:$coursesave
Help requested:$helpdesc
Student name:".$thestudent->getFirstname(). " " .$thestudent->getLastname(). "
Student email:".$thestudent->getEmail(). "Session Date:".$theschedule->getThedate()."
Day:".$theschedule->getDay()."
Start time:".$theschedule->getTimestart()."
Stop time:".$theschedule->getTimeend()."
Format:$theformat
Semester:".$theschedule->getSname()."
Tutor name:".$thetutor->getFirstname(). " " .$thetutor->getLastname(). "
Tutor email:".$thetutor->getEmail(). "
WebEx URL: $sessionURL
WebEx Phone Number:". $phoneIN. "
WebEx Session Access Code:". $accessCode. "
Date Reservation submitted:$today
Login Error
Sorry, the username and password do not match any current account.
Try again, or contact the Tutor account administrator.
0 ) { echo "

"; echo "

You currently have $count tutoring sessions over the next 2 weeks.
"; echo "
Be sure to check your site daily as students can register at anytime.
"; echo "
Also, students must register and be on your schedule to receive tutoring assistance.
"; echo ""; echo " "; echo "
"; echo "
Course
"; echo "
Student Name
"; echo "
Email
"; echo "
Tutor Session Details
"; echo "
Location
"; echo "
Help Details
"; echo ""; // Now retrieve the display information $tutorview = array(); foreach ($sid as $s) { $data = getTutorview($s); $tutorview [] = $data; } // Now display the Tutorview foreach ($tutorview as $t) { // Extract the data $id = $t->getID(); $thedate = $t->getThedate(); $day = $t->getDay(); $tstart = $t->getTstart(); $tend = $t->getTend(); $f2f = $t->getF2f(); $sname = $t->getSname(); $tname = $t->getTname(); $help = $t->getHelp(); $course = $t->getCourse(); $firstname = $t->getFirstname(); $lastname = $t->getLastname(); $email = $t->getEmail(); echo "
"; echo "
$course
"; echo "
$firstname $lastname
"; echo "
$email
"; echo "
$thedate,$day,$tstart-$tend
"; echo "
" . getLocation($f2f) . "
"; echo "
$help
"; echo ""; } echo ""; } else { echo "
No students have currently registered for your scheduled tutoring sessions over the next 14 days
"; } echo "
You can click on the link below to view all of your sessions for this semester. You can also delete sessions for emergency situations using this link.
"; echo "
Show all of my sessions
"; } ?>

Demo/tlogin.html

UMUC logo CS Tutor

Welcome to the CMIS and CMSC Tutor Site

Sign in using your WebTycho username and tutor password in the form below.
Sign in to your CSTutor Account:
WebTycho username:
Tutor Password:
 

Demo/tutors.css

/* Document : webstaffer CSS Created on : Jan 1, 2011, 4:27:27 PM Author : James Robertson Description: Purpose of the stylesheet follows. */ /* Syntax recommendation http://www.w3.org/TR/REC-CSS2/ */ body { display: block; background-color: white; font-family: Arial,Helvetica,sans-serif; font-size:1.2em; } h1 { display: block; color: #003366; text-align: center; } h2 { display: block; color: #990000; text-align: center; } h3 { display: block; color: #990000; text-align: center; } h4 { display: block; color: #990000; font-style: center; } h5 { display: block; color: #003366; text-align: left; } h6 { display: block; color: #000000; text-align: left; } #myheader { margin:auto; width:85%; border-collapse:collapse; } #myheader td, #myheader th { font-size:1.2em; border:1px solid #CC9900; padding:3px 7px 2px 7px; } #myheader tr { font-size:1.2em; text-align:left; padding-top:5px; padding-bottom:4px; background-color:#ffffff; color:#003366; } #myheader tr.alt td { color:#000000; background-color:#666600; } table { margin:auto; width:85%; text-align: left; } td { vertical-align:bottom; } div { text-align: center; } #mylogin { margin:auto; width:40%; text-align: left; } #myerror { margin:auto; width:40%; text-align: center; } #myformouter { margin:auto; width:85%; border:1px solid #CC9900; text-align: center; border-collapse:collapse; } #myformouter td, #myformouter th { font-size:1.2em; border:1px solid #CC9900; padding:3px 7px 2px 7px; border-collapse:collapse; } #myformouter tr { font-size:1.2em; text-align:left; padding-top:5px; padding-bottom:4px; background-color:#ffffff; color:#003366; border-collapse:collapse; } #myforminner { margin:auto; border:0px; text-align: left; vertical-align:middle; width:100%; } #myforminner td, #myforminner th { border:0px; padding:3px 7px 2px 7px; font-size:1.0em; color:#000000; vertical-align:middle; } #myforminner tr { text-align:left; padding-top:5px; padding-bottom:4px; font-size:1.0em; color:#000000; vertical-align:middle; } #myforminner tr.do2 td { color:#000000; background-color:#eee9e9; } #myresults { margin:auto; width:70%; border:1px solid #CC9900; text-align: center; border-collapse:collapse; } #myresults td, #myresults th { font-size:1.0em; border:1px solid #CC9900; padding:3px 7px 2px 7px; border-collapse:collapse; vertical-align:middle; } #myresults tr { font-size:1.0em; text-align:left; padding-top:5px; padding-bottom:4px; background-color:#ffffff; color:#000000; border-collapse:collapse; vertical-align:middle; } #mybuttons { margin:auto; border:0px; text-align: center; } #mybuttons td, #mybuttons th { border:0px; padding:3px 7px 2px 7px; font-size:1.0em; color:#000000; } #mybuttons tr { text-align:center; padding-top:5px; padding-bottom:4px; font-size:1.0em; color:#000000; } #mylogout { margin:auto; border:0px; text-align: left; } #mylogout td, #mylogout th { border:0px; padding:3px 7px 2px 7px; font-size:1.0em; color:#000000; } #mylogout tr { text-align:left; padding-top:5px; padding-bottom:4px; font-size:1.0em; color:#000000; }