function sendWarningNotice($userid, $reason, $type) { $subject = "Reservation System Warning"; $message = "You have been given a(n) " . getWarningType($type) . ". The reason given was: " . $reason; $headers = 'From: ' . getConfigVar('smtp_email') . "\r\n" . 'Reply-To: ' . getConfigVar('smtp_email') . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $user = mysql_fetch_assoc(getUserByID($userid)); //sendMail(getConfigVar('smtp_email'), $user['email'], $subject, $message); mail($row['email'], $subject, $message); }
echo "\r\n\r\n\t\t<center><h3>Warn " . $user['name'] . "</h3></center>\r\n\r\n\t\t<form action=\"./index.php?pageid=submitwarning\" method=\"POST\">\r\n\t\t<input type=\"hidden\" name=\"user_id\" value=\"" . $_GET['user_id'] . "\">\r\n\t\t\t<table class=\"warning\">\r\n\t\t\t\r\n\t\t\t\t<tr>\r\n\t\t\t\t\r\n\t\t\t\t\t<td colspan=2 class=\"centeredcellbold\">Warn Reason</td>\r\n\t\t\t\t\t\r\n\t\t\t\t</tr>\r\n\t\t\t\t\r\n\t\t\t\t<tr>\r\n\t\t\t\t\r\n\t\t\t\t\t<td colspan=2 class=\"centeredcellbold\"><textarea cols=\"55\" rows=\"7\" name=\"reason\"></textarea></td>\r\n\t\t\t\t\r\n\t\t\t\t</tr>\r\n\t\t\t\t\r\n\t\t\t\t<tr>\r\n\t\t\t\t\r\n\t\t\t\t\t<td class=\"centeredcell\"><select name=\"type\"><option value=\"1\">Active</option><option value=\"2\">Notification</option><option value=\"3\">Inactive</option></select></td>\r\n\t\t\t\t\t<td class=\"centeredcell\"><input type=\"submit\" value=\"Warn\"></textarea></td>\r\n\t\t\t\t\r\n\t\t\t\t</tr>\r\n\t\t\t\r\n\t\t\t</table>\r\n\t\t\r\n\t\t</form>\r\n\r\n\t"; } else { if ($pageid == "submitwarning") { warnUser($_POST['user_id'], $_POST['reason'], $_POST['type']); $user = mysql_fetch_assoc(getUserByID($_POST['user_id'])); echo "<center><h3>" . $user['name'] . " Warned</h3><a href=\"./index.php?pageid=edituser&user="******"\">View User</a></center>"; } else { if ($pageid == "viewwarnings") { if (getSessionVariable('user_level') < getConfigVar("admin_rank") && getSessionVariable('user_id') != $_GET['user_id']) { echo "<center><h3><font color=\"#FF0000\">Error: You are not authorized to view other user's warnings.</font></h3></center>"; } else { $warnings = getWarningsForUser($_GET['user_id']); $user = mysql_fetch_assoc(getUserByID($_GET['user_id'])); $options = ""; while ($row = mysql_fetch_assoc($warnings)) { $options = $options . "<option value=\"" . $row['warn_id'] . "\">" . $row['time'] . " - " . getWarningType($row['type']) . "</option>"; } echo "<center><h3>View Warnings For " . $user['name'] . "</h3>"; if ($options != "") { echo "<form action=\"index.php\" method=\"GET\">\r\n\t\t\t<input type=\"hidden\" name=\"pageid\" value=\"editwarning\">\r\n\t\t\t<select name=\"warn_id\">" . $options . "</select><input type=\"submit\" value=\"View\"></form></center>"; } else { echo "<h4>User has no warnings.</h4>"; } } } else { if ($pageid == "editwarning" || $pageid == "savewarning") { $message = ""; if ($pageid == "savewarning") { saveWarning($_POST['warn_id'], $_POST['reason'], $_POST['type']); $warning = mysql_fetch_assoc(getWarningByID($_POST['warn_id'])); $message = "<font color=\"#008800\"><b>Warning Saved</b></font><br><br>";
<?php $userid = getSessionVariable('user_id'); $warnings = getWarningsForUser($userid); $user = mysql_fetch_assoc(getUserByID($userid)); $options = ""; $types = array(RES_WARNING_ACTIVE => "Active", RES_WARNING_NOTE => "Note", RES_WARNING_INACTIVE => "Inactive"); while ($row = mysql_fetch_assoc($warnings)) { $options = $options . "<option value=\"" . $row['warn_id'] . "\">" . $row['time'] . " - " . $types[$row['type']] . "</option>"; } echo "<center><h3>View Warnings For " . $user['name'] . "</h3>"; if ($options != "") { echo "<form action=\"index.php\" method=\"GET\">\r\n\t\t<input type=\"hidden\" name=\"pageid\" value=\"viewmywarning\">\r\n\t\t<select name=\"warn_id\">" . $options . "</select><input type=\"submit\" value=\"View\"></form>"; } else { echo "<h4>You don't have any warnings. :)</h4>"; } if ($pageid == "viewmywarning") { $warning = mysql_fetch_assoc(getWarningByID($_GET['warn_id'])); echo "<table class=\"warning\">\r\n\t\t\t<tr>\r\n\t\t\t\r\n\t\t\t\t<td colspan=2 class=\"centeredcellbold\">Warning Reason</td>\r\n\t\t\t\r\n\t\t\t</tr>\r\n\t\t\t\r\n\t\t\t<tr>\r\n\t\t\t\r\n\t\t\t\t<td colspan=2 class=\"centeredcell\"><textarea cols=\"55\" rows=\"7\" readonly>" . $warning['reason'] . "</textarea></td>\r\n\t\t\t\r\n\t\t\t</tr>\r\n\t\t\t\r\n\t\t\t<tr>\r\n\t\t\t\r\n\t\t\t\t<td class=\"centeredcellbold\">Type: " . getWarningType($warning['type']) . "</td>\r\n\t\t\t\t<td class=\"centeredcellbold\">Time: " . $warning['time'] . "</td>\r\n\t\t\t\r\n\t\t\t</tr>\r\n\t\t\r\n\t\t</table>"; } echo "</center>";
if($pageid == "viewmywarning"){ $warning = mysql_fetch_assoc(getWarningByID($_GET['warn_id'])); echo "<table class=\"warning\"> <tr> <td colspan=2 class=\"centeredcellbold\">Warning Reason</td> </tr> <tr> <td colspan=2 class=\"centeredcell\"><textarea cols=\"55\" rows=\"7\" readonly>".$warning['reason']."</textarea></td> </tr> <tr> <td class=\"centeredcellbold\">Type: ".getWarningType($warning['type'])."</td> <td class=\"centeredcellbold\">Time: ".$warning['time']."</td> </tr> </table>"; } echo "</center>"; ?>