File: /home/awaldron/www/archive/demo/event_new_is.php
<?php
session_start();
include("_functions.php");
dbconnect();
if (isset($_GET["del"])) {
quickUPDATE("DELETE FROM tbl_event_is WHERE eis_id=".$_GET["del"]);
}
if (isset($_POST["adddate"])) {
extract($_POST);
$ins = "INSERT INTO tbl_event_is (event_id,eis_desc,eis_title) VALUES (";
$ins .= $event_id.",";
$ins .= "'".$message."',";
$ins .= "'".$eis_title."')";
$res = quickUPDATE($ins);
if ($res === FALSE) $error = error("There was an error while attempting to insert this event.");
}
if (isset($_POST["editdate"])) {
extract($_POST);
$upd = "UPDATE tbl_event_is SET ";
$upd .= "eis_title='".$eis_title."', ";
$upd .= "eis_desc='".$message."' ";
$upd .= "WHERE eis_id=".$eis_id;
$res = quickUPDATE($upd);
if ($res === FALSE) $error = error("There was an error while attempting to edit this event.");
}
$sql = "SELECT * FROM tbl_event WHERE event_id=".$_GET["id"];
$res = mysql_query($sql);
extract(mysql_fetch_array($res));
$bbjava = true;
$page_title = "Add Dates to \"".$event_title."\"";;
$GLOBALS["ext_page"] = "New Event: Add Dates / Times"; // SET FAUX PAGE NAME
$_GET["p"] = 1; // SET FAUX PARENT ID
$lnav_mods = get_layout($_GET["p"],1);
$rnav_mods = get_layout($_GET["p"],3);
include("_pagestart.php");
echo "<div class=\"headline\">".$page_title."</div>\n";
echo "<div class=\"pagebody\">\n";
if (authorize($event_owner)) {
if ($event_word == 1) {
$word = "class";
} else if ($event_word == 2) {
$word = "event";
}
$sql = "SELECT * FROM tbl_event_is WHERE event_id=".$_GET["id"]." ORDER BY eis_title ASC";
$res = mysql_query($sql);
$times = "<br><br><table border=0 cellspacing=1 cellpadding=4 bgcolor=\"#C0C0C0\">\n";
$times .= "<tr id=\"head-row\"><td>".ucfirst($word)."</td><td>Description</td><td>Actions</td></tr>\n";
if (mysql_num_rows($res) < 1) {
$times .= "<tr id=\"dat-input\"><td colspan=6>Nothing has been added to this ".$word."</td></tr>\n";
} else for ($i=0; $row = mysql_fetch_array($res); $i++) {
$times .= "<tr id=\"".($i%2==0?"dat-input":"dat-field")."\"".($_GET["edit"]==$row["eis_id"]?" style=\"background:#D5EFFF\"":"").">\n";
$times .= "<td>".$row["eis_title"]."</td>\n";
$times .= "<td>".(zero($row["eis_desc"])?"None":"Click Edit to View")."</td>\n";
$times .= "<td><a href=\"".(isset($_GET["edit"])?substr(self(),0,strrpos(self(),"&")):self())."&edit=".$row["eis_id"]."\">Edit</a> | <a href=\"javascript:deleteEvent(".$row["event_id"].",".$row["eis_id"].",'is');\">Delete</a></td>\n";
$times .= "</tr>\n";
if (isset($_GET["edit"])) {
if ($_GET["edit"] == $row["eis_id"]) {
$maxtitle = $row["eis_title"];
$maxdesc = $row["eis_desc"];
}
} else {
$maxtitle = ""; //$row["eis_title"];
$maxdesc = "";
}
}
$times .= "</table>\n";
// FORM TO ADD ANOTHER EVENT FOR INTEREST SHEET
echo "<P>".$error;
echo "<form action=\"".(isset($_GET["edit"])?substr(self(),0,strrpos(self(),"&")):self())."\" method=\"post\" name=\"newtime\">\n";
echo "<input type=\"hidden\" name=\"event_id\" value=\"".$_GET["id"]."\">\n";
if (isset($_GET["edit"])) echo "<input type=\"hidden\" name=\"eis_id\" value=\"".$_GET["edit"]."\">\n";
echo "<P><table border=0 cellspacing=1 cellpadding=4 bgcolor=\"#C0C0C0\">\n";
if (isset($_GET["edit"])) echo "<tr><td id=\"head-row\" style=\"background:#D5EFFF\" colspan=2><b>Editing ".$word." \"".$maxtitle."\"</b></td></tr>\n";
else echo "<tr><td id=\"head-row\" style=\"background:#B9EBB3\" colspan=2><b>Add a new ".$word." for which to gather interest:</b></td></tr>\n";
echo "<tr><td id=\"dat-field\">".ucfirst($word)." Title</td><td id=\"dat-input\"><input type=\"text\" name=\"eis_title\" value=\"".$maxtitle."\" size=60></td></tr>\n";
echo "<tr><td id=\"dat-field\" valign=\"top\">".ucfirst($word)." Description</td><td id=\"dat-input\">".ins_textarea(stripslashes($maxdesc),0,0,0,0,625,175)."</td></tr>\n";
if (isset($_GET["edit"])) echo "<tr><td bgcolor=\"#F0F0F0\" colspan=2><input type=\"submit\" name=\"editdate\" value=\"Edit This ".ucfirst($word)."\" class=\"btn\"> <input type=\"button\" onClick=\"location.href='/event_new_is.php?id=".$_GET["id"]."'\" value=\"Cancel Edit\" class=\"btn\"></td></tr>\n";
else echo "<tr><td bgcolor=\"#F0F0F0\" colspan=2><input type=\"submit\" name=\"adddate\" value=\"Add New ".ucfirst($word)."\" class=\"btn\"></td></tr>\n";
echo "</table>\n";
echo "</form>\n";
echo $times;
echo "<P><a href=\"event_new_is.php?id=".$_GET["id"]."\">Refresh This Page</a> | <a href=\"/eventreg_is.php?id=".$_GET["id"]."\">Go To Sign-Up Page</a></center>\n";
} else {
echo "<br><br><br><center>".error("You do not have the proper permissions to edit this information.")."<br><br><br></center>\n";
}
echo "</div>\n";
echo "<br><br><br><br><div class=\"pagefoot\" style=\"border-width:1px 0px 0px 0px;\"><div style=\"float:right\">Last Updated: ".date("F j, Y")." by <a href=\"/profile.php?u=awaldron\">awaldron</a></div></div>\n";
include("_pageend.php");
?>