Help Round 2
UMUCTutorLamp/week8/SQL/create_tables.sql
use sdev; -- clean-up database drop table TutorDetails; drop table StudentSchedules; drop table TutorSchedules; drop table GroupSchedules; drop table CourseGroups; drop table TutorGroups; drop table Students; drop table Semesters; drop table Courses; drop table Tutors; -- Students table for CREATE TABLE Students ( firstName varchar(30), lastName varchar(30), eMail varchar(60), tychoName varchar(30) primary key ); -- Semesters table CREATE TABLE Semesters( sName varchar(14) primary key, sStart date, sStop date ); -- Some Semester data insert into Semesters values ('Spring 2015','2015-01-12','2015-05-10'); insert into Semesters values ('Summer 2015','2015-05-18','2015-08-09'); CREATE TABLE Courses( courseDisc varchar(4), courseNum varchar(4), courseTitle varchar(75), Constraint Primary Key (courseDisc,courseNum) ); -- Load some courses for First semester: insert into Courses values ('CMIS', '102','Introduction to Problem Solving and Algorithm Design'); insert into Courses values ('CMIS', '141','Introductory Programming'); insert into Courses values ('CMIS' ,'242','Intermediate Programming'); insert into Courses values ('CMIS' ,'320','Relational Database Concepts and Applications'); -- Tutor table CREATE TABLE Tutors ( firstName varchar(30), lastName varchar(30), eMail varchar(60), tychoName varchar(30) primary key, f2f char(1) ); -- Insert some tutors insert into Tutors values ('Tutor','One','[email protected]','tutor1','N'); insert into Tutors values ('Tutor','Two','[email protected]','tutor2','N'); insert into Tutors values ('Tutor','Three','[email protected]','tutor3','N'); -- CourseGroups for storing groups of courses tutors support -- Tutor Courses table CREATE TABLE CourseGroups ( groupName varchar(10), courseDisc varchar(4), courseNum varchar(4), Constraint Primary Key (groupName,courseDisc,courseNum), Constraint Foreign Key (courseDisc,courseNum) references Courses(courseDisc,courseNum) ); -- Insert some CourseGroups insert into CourseGroups values ('A','CMIS','102'); insert into CourseGroups values ('B','CMIS','141'); insert into CourseGroups values ('B','CMIS','242'); insert into CourseGroups values ('C','CMIS','320'); -- Tutor Groups table CREATE TABLE TutorGroups ( tychoName varchar(30), groupName varchar(10), Constraint Primary Key (tychoName,groupName), Constraint Foreign Key (tychoName) references Tutors(tychoName), Constraint Foreign Key (groupName) references CourseGroups(groupName) ); -- Insert TutorGroups data insert into TutorGroups values ('tutor1','A'); insert into TutorGroups values ('tutor2','B'); insert into TutorGroups values ('tutor3','C'); -- Create GroupSchedule table -- Holds Courses to be covered for a specific day and time range -- time is 24 hour clock (4PM = 1600) CREATE TABLE GroupSchedules( scheduleID int NOT NULL AUTO_INCREMENT PRIMARY KEY, thedate date, day varchar(10), timeStart int, timeEnd int, groupName varchar(10), f2f char(1), sName varchar(14), Constraint Foreign Key (groupName) references CourseGroups(groupName), Constraint Foreign Key (sName) references Semesters(sName) ); -- Insert schedule data (This should be fairly stable each semester) -- Manual brute force method first time. Run script after this -- Week 12 Apr 20-26 insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-20','Sunday',900,930,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-20','Sunday',930,1000,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-20','Sunday',1000,1030,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-20','Sunday',1030,1100,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-20','Sunday',1100,1130,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-20','Sunday',1130,1200,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-20','Sunday',1200,1230,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-20','Sunday',1230,1300,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-21','Monday',1800,1830,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-21','Monday',1830,1900,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-21','Monday',1900,1930,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-21','Monday',1930,2000,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-21','Monday',2000,2030,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-21','Monday',2030,2100,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-21','Monday',2100,2130,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-21','Monday',2130,2200,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-22','Tuesday',1800,1830,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-22','Tuesday',1830,1900,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-22','Tuesday',1900,1930,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-22','Tuesday',1930,2000,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-22','Tuesday',2000,2030,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-22','Tuesday',2030,2100,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-22','Tuesday',2100,2130,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-22','Tuesday',2130,2200,'C','N','Spring 2015'); -- Week 13 Apr 27 - May 3 insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-27','Sunday',900,930,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-27','Sunday',930,1000,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-27','Sunday',1000,1030,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-27','Sunday',1030,1100,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-27','Sunday',1100,1130,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-27','Sunday',1130,1200,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-27','Sunday',1200,1230,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-27','Sunday',1230,1300,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-28','Monday',1800,1830,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-28','Monday',1830,1900,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-28','Monday',1900,1930,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-28','Monday',1930,2000,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-28','Monday',2000,2030,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-28','Monday',2030,2100,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-28','Monday',2100,2130,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-04-28','Monday',2130,2200,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',1800,1830,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',1830,1900,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',1900,1930,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',1930,2000,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',2000,2030,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',2030,2100,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',2100,2130,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',2130,2200,'C','N','Spring 2015'); -- Week 14 May 4 - May 10 insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-04','Sunday',900,930,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-04','Sunday',930,1000,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-04','Sunday',1000,1030,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-04','Sunday',1030,1100,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-04','Sunday',1100,1130,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-04','Sunday',1130,1200,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-04','Sunday',1200,1230,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-04','Sunday',1230,1300,'A','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-05','Monday',1800,1830,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-05','Monday',1830,1900,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-05','Monday',1900,1930,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-05','Monday',1930,2000,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-05','Monday',2000,2030,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-05','Monday',2030,2100,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-05','Monday',2100,2130,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-05','Monday',2130,2200,'B','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',1800,1830,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',1830,1900,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',1900,1930,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',1930,2000,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',2000,2030,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',2030,2100,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',2100,2130,'C','N','Spring 2015'); insert into GroupSchedules (thedate,day,timeStart,timeEnd,groupName,f2f,sName) values ('2015-05-06','Tuesday',2130,2200,'C','N','Spring 2015'); -- TutorSchedule table to align with the GroupSchedules CREATE TABLE TutorSchedules( scheduleID int NOT NULL, tychoName varchar(30), Constraint Foreign Key (tychoName) references Tutors(tychoName), Constraint Foreign Key (scheduleID) references GroupSchedules(scheduleID), Constraint Primary Key (scheduleID,tychoName) ); -- Insert data insert into TutorSchedules values (1,'tutor1'); insert into TutorSchedules values (2,'tutor1'); insert into TutorSchedules values (3,'tutor1'); insert into TutorSchedules values (4,'tutor1'); insert into TutorSchedules values (5,'tutor1'); insert into TutorSchedules values (6,'tutor1'); insert into TutorSchedules values (7,'tutor1'); insert into TutorSchedules values (8,'tutor1'); insert into TutorSchedules values (9,'tutor2'); insert into TutorSchedules values (10,'tutor2'); insert into TutorSchedules values (11,'tutor2'); insert into TutorSchedules values (12,'tutor2'); insert into TutorSchedules values (13,'tutor2'); insert into TutorSchedules values (14,'tutor2'); insert into TutorSchedules values (15,'tutor2'); insert into TutorSchedules values (16,'tutor2'); insert into TutorSchedules values (17,'tutor3'); insert into TutorSchedules values (18,'tutor3'); insert into TutorSchedules values (19,'tutor3'); insert into TutorSchedules values (20,'tutor3'); insert into TutorSchedules values (21,'tutor3'); insert into TutorSchedules values (22,'tutor3'); insert into TutorSchedules values (23,'tutor3'); insert into TutorSchedules values (24,'tutor3'); -- Week 2 insert into TutorSchedules values (25,'tutor1'); insert into TutorSchedules values (26,'tutor1'); insert into TutorSchedules values (27,'tutor1'); insert into TutorSchedules values (28,'tutor1'); insert into TutorSchedules values (29,'tutor1'); insert into TutorSchedules values (30,'tutor1'); insert into TutorSchedules values (31,'tutor1'); insert into TutorSchedules values (32,'tutor1'); insert into TutorSchedules values (33,'tutor2'); insert into TutorSchedules values (34,'tutor2'); insert into TutorSchedules values (35,'tutor2'); insert into TutorSchedules values (36,'tutor2'); insert into TutorSchedules values (37,'tutor2'); insert into TutorSchedules values (38,'tutor2'); insert into TutorSchedules values (39,'tutor2'); insert into TutorSchedules values (40,'tutor2'); insert into TutorSchedules values (41,'tutor3'); insert into TutorSchedules values (42,'tutor3'); insert into TutorSchedules values (43,'tutor3'); insert into TutorSchedules values (44,'tutor3'); insert into TutorSchedules values (45,'tutor3'); insert into TutorSchedules values (46,'tutor3'); insert into TutorSchedules values (47,'tutor3'); insert into TutorSchedules values (48,'tutor3'); -- week 3 insert into TutorSchedules values (49,'tutor1'); insert into TutorSchedules values (50,'tutor1'); insert into TutorSchedules values (51,'tutor1'); insert into TutorSchedules values (52,'tutor1'); insert into TutorSchedules values (53,'tutor1'); insert into TutorSchedules values (54,'tutor1'); insert into TutorSchedules values (55,'tutor1'); insert into TutorSchedules values (56,'tutor1'); insert into TutorSchedules values (57,'tutor2'); insert into TutorSchedules values (58,'tutor2'); insert into TutorSchedules values (59,'tutor2'); insert into TutorSchedules values (60,'tutor2'); insert into TutorSchedules values (61,'tutor2'); insert into TutorSchedules values (62,'tutor2'); insert into TutorSchedules values (63,'tutor2'); insert into TutorSchedules values (64,'tutor2'); insert into TutorSchedules values (65,'tutor3'); insert into TutorSchedules values (66,'tutor3'); insert into TutorSchedules values (67,'tutor3'); insert into TutorSchedules values (68,'tutor3'); insert into TutorSchedules values (69,'tutor3'); insert into TutorSchedules values (70,'tutor3'); insert into TutorSchedules values (71,'tutor3'); insert into TutorSchedules values (72,'tutor3'); -- Now need a place for Students to sign-up based on the tutors time schedule CREATE TABLE StudentSchedules( scheduleID int NOT NULL, tychoName varchar(30), helpDescription varchar(255), courseInfo varchar(10), RegisterDate varchar(50), Constraint Foreign Key (tychoName) references Students(tychoName), Constraint Foreign Key (scheduleID) references GroupSchedules(scheduleID), Constraint Primary Key (scheduleID,tychoName) ); -- Table for Tutor passwords CREATE TABLE TutorDetails( tychoName varchar(30), password varchar(25), Constraint Foreign Key (tychoName) references Tutors(tychoName), Constraint Primary Key (tychoName) ); insert into TutorDetails values ('tutor1','t123'); insert into TutorDetails values ('tutor2','t234'); insert into TutorDetails values ('tutor3','t345');
UMUCTutorLamp/week8/Tutor/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. |
UMUCTutorLamp/week8/Tutor/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
"; } } ?>UMUCTutorLamp/week8/Tutor/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"; } }UMUCTutorLamp/week8/Tutor/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
"; } } } ?>UMUCTutorLamp/week8/Tutor/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
"; } } ?>UMUCTutorLamp/week8/Tutor/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"; } }UMUCTutorLamp/week8/Tutor/Images/Thumbs.db
UMUCTutorLamp/week8/Tutor/Images/umuc_logo.jpg
UMUCTutorLamp/week8/Tutor/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; } ?>
UMUCTutorLamp/week8/Tutor/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 ?>
UMUCTutorLamp/week8/Tutor/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 ?>
UMUCTutorLamp/week8/Tutor/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 ?>
UMUCTutorLamp/week8/Tutor/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; } ?>
UMUCTutorLamp/week8/Tutor/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; } ?>
UMUCTutorLamp/week8/Tutor/index.html
| Are you sure you want to permanently delete this session? |
| $dtext |
|
|
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. |
UMUCTutorLamp/week8/Tutor/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? |
UMUCTutorLamp/week8/Tutor/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 S3: Reservation success from 38, jstegman, CMIS141 on April 20, 2015, 12:18 pm was 1 S4: Reservation Email sent to [email protected], [email protected] on April 20, 2015, 12:18 pm was S3: Reservation success from 40, jrobertson1, CMIS141 on April 20, 2015, 12:37 pm was 1 S4: Reservation Email sent to [email protected], [email protected] on April 20, 2015, 12:37 pm was
UMUCTutorLamp/week8/Tutor/parms/dbparms.txt
username=sdev_owner password=sdev300 host=localhost db=sdev
UMUCTutorLamp/week8/Tutor/parms/emailparms.txt
smtphost=yourmailserverhere smtpport=25 smtpauth=false smtpuser="" smtppass="" [email protected]
UMUCTutorLamp/week8/Tutor/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 ?> UMUCTutorLamp/week8/Tutor/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 "
|