Small security changes to feed page.
[Assignment-Trapper.git] / comment.php
blob1a9e422cae5b3ae32836beb6ed30617939e524b1
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 echo "Data Posted Sucessfully<br><br>";
32 echo 'Click <a href=detail_root.php?sched='.$_GET["sched"].'>Here</a> To Return to Assignment Details';
35 //echo '<html><meta http-equiv="refresh" content="0; detail.php?sched='.$_GET["sched"].'" /></html>';