Added classes menu for students with more than one class.
[Assignment-Trapper.git] / comment.php
blob3abc9dc303d601d920e5198114555c429542a346
1 <?php
3 include_once("auth.php");
4 //include_once("header.php");
6 if (!$_GET["comment"]) { die("No Comment Sent"); }
7 if (!$_GET["sched"]) { die("No Schedule ID Sent"); }
9 $_GET["user"] = mysql_real_escape_string($_GET["user"]);
10 $_GET["sched"] = mysql_real_escape_string($_GET["sched"]);
11 $_GET["comment"] = mysql_real_escape_string($_GET["comment"]);
13 // faculty must submit not only the schedule, but the user commented about as well
14 if($role == 0 && !$_GET["user"]) { die("No User ID Sent"); }
16 if($_GET["comment"] == "") { die("Comment Must Not Be Empty"); }
18 if($role == 0) { // faculty comment to student
19 $sql = 'insert into comments values("", '.$_GET["user"].', '.$_GET["sched"].','.$user_id.','.$role.', "'.$_GET["comment"].'", NOW())';
20 } else { // student comment to faculty
21 $sql = 'insert into comments values("", '.$user_id.', '.$_GET["sched"].', NULL,'.$role.', "'.$_GET["comment"].'", NOW())';
24 //echo $sql;
26 $result = mysql_query($sql);
28 if (!$result) { die("SQL ERROR"); } else {
30 // send message to user as reciept of file
32 $uid = md5(uniqid(time()));
35 $from_name = "Assignment Trapper";
36 $from_mail = "noreply@opentextbook.info";
38 $message = "Comment about Assignment<br><br>";
39 $message .= '<a href=http://opentextbook.info/at/detail_root.php?sched='.$_GET["sched"].'>Click Here</a> to view.';
41 $header = "From: ".$from_name." <".$from_mail.">\r\n";
42 $header .= "Reply-To: ".$replyto."\r\n";
43 $header .= "MIME-Version: 1.0\r\n";
44 $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
45 $header .= "This is a multi-part message in MIME format.\r\n";
46 $header .= "--".$uid."\r\n";
47 $header .= "Content-type:text/html; charset=iso-8859-1\r\n";
48 $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
49 $header .= $message;
51 //mail($user_email, "Comment About Assignment", "", $header);
52 mail("steven.schronk@my.tccd.edu", "Comment About Assignment", "", $header);
56 if($_GET["action"] == 'ret') {
57 echo '<html><meta http-equiv="refresh" content="0;url=detail_root.php?sched='.$_GET["sched"].'&user='.$_GET["user"].'" /></html>';
58 } else {
59 echo '<html><meta http-equiv="refresh" content="0;url=detail_root.php?sched='.$_GET["sched"].'" /></html>';