Testing Framework and Basic Security Controls
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 "Warning! Form Entry Errors Exist."; echo "Please revise based on the following issues and submit again."; 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: | |
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 = "jrobertson@umuc.edu"; // 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:
First time users need to create an account by clicking on the link below. |
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 "| Session ID |
|---|
| Date |
|---|
| Day |
|---|
| Times |
|---|
| Course(s) |
|---|
| Location |
|---|
| Semester |
|---|
| Delete? |
|---|
| $sid |
| $thedate |
| $day |
| $tstart-$tend |
| " . getGroupCourses($group). " |
| " . getLocation($f2f). " |
| $sname |
| Delete Session? |
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 james.robertson@umuc.edu, tutor1@umuc.edu 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 james.robertson@umuc.edu, tutor1@umuc.edu 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 james.robertson@umuc.edu, tutor2@umuc.edut 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 james.robertson@umuc.edu, tutor2@umuc.edut 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 james.robertson@umuc.edu, tutor1@umuc.edu 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="" smtpfrom=donotreply@umuc.edu
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 "
| Course | Date | Time | Tutoring Location | Help Requested | Tutor | Cancel Session? |
|---|---|---|---|---|---|---|
| $course | $thedate, $day | $tstart-$tend | $f2f | $help | $firstname $lastname ($email) | Cancel Session $id? |
| 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.php0 && 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 "
|