File: /home/awaldron/public_html/archive/demo/event_add.php
<?php
session_start();
?>
<html>
<head>
<title><-Vocollect Inc.-> View Calendar Event</title>
</head>
<link rel="stylesheet" type="text/css" href="default.css">
<body style="margin:15px;font-size:12px;">
<?php
include("_functions.php");
if (!is_logged()) {
echo error("You must be logged in to add a calendar event.");
} else {
if (!isset($_POST["submit"])) {
$d = date_tstounix($_GET[d]);
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=\"event_add.php\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"cal_date\" value=\"".$_GET["d"]."\">\n";
echo "<input type=\"hidden\" name=\"calendar_id\" value=\"".$_GET["cid"]."\">\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\"></td></tr>\n";
echo "<tr><td>Link Title to URL?</td><td><input type=\"text\" style=\"width:180;\" name=\"cal_linkto\" value=\"http://\"></td></tr>\n";
echo "<tr><td>Event Type:</td><td><SELECT name=\"cal_type\"><option value=1>Event</option><option value=2>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\"></td></tr>\n";
echo "</table>\n";
echo "</form>\n";
} else {
dbconnect();
extract($_POST);
if (strlen($cal_linkto) <= 7) $cal_linkto = "0";
$sql = "INSERT INTO tbl_calendar_dates (cal_date,calendar_id,cal_title,cal_linkto,cal_type,username) VALUES ";
$sql .= "(".$cal_date.",".$calendar_id.",'".$cal_title."','".$cal_linkto."',".$cal_type.",'".$username."')";
$result = mysql_query($sql);
echo "<script>window.opener.location.reload();location.href='/event_view.php?d=".$cal_date."&cid=".$calendar_id."';</script>\n";
}
}
?>
</body>
</html>