File: /home/awaldron/public_html/archive/demo/event_edit.php
<?php
session_start();
echo "<html>\n";
echo "<head>\n";
echo "<title>".CMP_NAME_INF." : Edit Calendar Event</title>\n";
echo "</head>\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"default.css\">\n";
echo "<body style=\"margin:15px;font-size:12px;\">\n";
include("_functions.php");
dbconnect();
if (!is_logged()) {
echo error("You must be logged in to add a calendar event.");
} else {
if (isset($_POST[delete])) {
quickUPDATE("DELETE FROM tbl_calendar_dates WHERE cal_id=".$_POST[cal_id]);
echo "<script>window.opener.location.reload();location.href='/event_view.php?d=".$_POST[cal_date]."&cid=".$_POST[calendar_id]."';</script>\n";
} else if (isset($_POST[submit])) {
if (strlen($cal_linkto) <= 7) $cal_linkto = "0";
else $cal_linkto = $_POST[cal_linkto];
$sql = "UPDATE tbl_calendar_dates SET ";
$sql .= "cal_title='".$_POST[cal_title]."', ";
$sql .= "cal_linkto='".$cal_linkto."', ";
$sql .= "cal_type=".$_POST[cal_type]." ";
$sql .= "WHERE cal_id=".$_POST[cal_id];
quickUPDATE($sql);
echo "<script>window.opener.location.reload();location.href='/event_view.php?d=".$_POST[cal_date]."&cid=".$_POST[calendar_id]."';</script>\n";
} else {
$row = quickROW("SELECT * FROM tbl_calendar_dates WHERE cal_id=".$_GET[cal_id]);
if (count($row) < 1) echo "<P>".error("The calendar date ID specified does not exist in the database.");
else {
$d = date_tstounix($row[cal_date]."000000");
echo "<P><b style=\"color:#DD0000;\">Only events that apply company-wide should be placed in the calendar!</b>\n";
echo "<P><span class=\"bold\">".date("F j, Y",$d).":</span><P>";
echo "<form action=\"".self()."\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"cal_date\" value=\"".$row[cal_date]."\">\n";
echo "<input type=\"hidden\" name=\"calendar_id\" value=\"".$row[calendar_id]."\">\n";
echo "<input type=\"hidden\" name=\"cal_id\" value=\"".$row[cal_id]."\">\n";
echo "<input type=\"hidden\" name=\"username\" value=\"".$_SESSION[auth_user]."\">\n";
echo "<P><center><table border=0 cellspacing=5>\n";
echo "<tr><td>Event Title:</td><td><input type=\"text\" style=\"width:180;\" name=\"cal_title\" value=\"".$row[cal_title]."\"></td></tr>\n";
echo "<tr><td>Link Title to URL?</td><td><input type=\"text\" style=\"width:180;\" name=\"cal_linkto\" value=\"".$row[cal_linkto]."\"></td></tr>\n";
echo "<tr><td>Event Type:</td><td><SELECT name=\"cal_type\"><option value=1".($row[cal_type]==1?" SELECTED":"").">Event</option><option value=2".($row[cal_type]==2?" SELECTED":"").">Holiday</option></SELECT></td></tr>\n";
echo "<tr><td>Your UserID:</td><td><input type=\"text\" style=\"width:180;\" name=\"dummy_username\" value=\"".$_SESSION[auth_user]."\" DISABLED></td></tr>\n";
echo "<tr><td colspan=2 align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Submit\"> <input type=\"submit\" name=\"delete\" value=\"Delete Event\"></td></tr>\n";
echo "</table>\n";
echo "</form>\n";
}
}
}
?>
</body>
</html>