File: //home/awaldron/public_html/archive/demo/eventreg_is.php
<?php
session_start();
include("_functions.php");
dbconnect();
if (isset($_GET["submit"]))
if (!isset($_GET["id"])) $_GET["id"] = quickSQL("SELECT MAX(event_id) FROM tbl_event WHERE event_type='is'");
if (isset($_GET["rid"])) {
$employee_type = quickSQL("SELECT emp_type_id FROM tbl_employees WHERE username='".$_SESSION["auth_user"]."'");
$event_emponly = quickSQL("SELECT event_emponly FROM tbl_event WHERE event_id=".$_GET["id"]);
if (($employee_type > 3) && ($event_emponly != 3)) {
header("Location: eventreg_is.php?id=".$_GET["id"]."&er=".base64_encode("Sorry, but this event is only open to Vocollect employees."));
} else {
$onlist = quickSQL("SELECT COUNT(registrant) FROM tbl_event_is_att WHERE registrant='".$_SESSION["auth_user"]."' AND eis_id=".$_GET["rid"]);
if ($onlist > 0) header("Location: eventreg_is.php?id=".$_GET["id"]."&er=".base64_encode("Your request could not be completed because you are already registered for this course."));
else {
quickUPDATE("INSERT INTO tbl_event_is_att (eis_id,attendee,registrant,att_time) VALUES (".$_GET["rid"].",'".get_user($_SESSION["auth_user"],"fullname2")."','".$_SESSION["auth_user"]."',".time().")");
header("Location: eventreg_is.php?id=".$_GET["id"]."&ty=".base64_encode("You have been added to the requested course attendees list."));
}
}
}
if (isset($_GET["del"])) {
quickUPDATE("DELETE FROM tbl_event_is_att WHERE isatt_id=".$_GET["del"]);
}
$s = "SELECT * FROM tbl_event WHERE event_id=".$_GET["id"];
$r = mysql_query($s);
extract(mysql_fetch_array($r));
if ($event_word == 1) {
$word = "class";
$maxnum = "Seats";
} else if ($event_word == 2) {
$word = "event";
$maxnum = "Max.";
}
$sql = "SELECT * FROM tbl_event_is WHERE event_id=".$event_id." ORDER BY eis_title ASC";
$res = mysql_query($sql);
//$bd = mysql_fetch_array($result);
$page_title = $event_title;
$GLOBALS["ext_page"] = $page_title; // SET FAUX PAGE NAME
$_GET["p"] = $event_parent; // SET FAUX PARENT ID
$lnav_mods = get_layout($_GET["p"],1);
$rnav_mods = get_layout($_GET["p"],3);
include("_pagestart.php");
echo "<script language=\"JavaScript\" type=\"text/javascript\">\n";
echo "<!--\n";
echo "function confirm_register(id) {\n";
echo " input_box=confirm(\"Are you sure you want to register for this ".$word."?\");\n";
echo " if (input_box==true) {\n";
echo " self.location=\"eventreg_is.php?id=".$_GET["id"]."&rid=\"+id;\n";
echo " }\n";
echo "}\n";
echo "function confirm_unregister(id) {\n";
echo " input_box=confirm(\"Are you sure you want to cancel your registration for this ".$word."?\");\n";
echo " if (input_box==true) {\n";
echo " self.location=\"eventreg_is.php?id=".$_GET["id"]."&del=\"+id;\n";
echo " }\n";
echo "}\n";
echo "-->\n";
echo "</script>\n";
echo "<div class=\"headline\">".$page_title."</div>\n";
echo "<div class=\"pagebody\">\n";
$logged = is_logged();
//if (authorize($event_owner)) echo "<P><table><tr><td><img src=\"gui/edit.gif\" border=0></td><td><a href=\"event_new_is.php?id=".$_GET["id"]."\">Edit ".$word." dates</a></td><td>| <a href=\"event_new.php?type=is&id=".$_GET["id"]."\">Edit ".$word." info</a></td></tr></table>";
echo "<P>";
echo format_body($event_desc,0);
if (($event_active == 1) && (zero($event_deadline) || (time() < $event_deadline))) {
echo "<br><br><br><ul>\n";
echo "<li> The following ".($word=="event"?"events":"classes")." do not have scheduled dates. You will be notified via email when ".($word=="event"?"an event":"a class")." has been scheduled.\n";
if (!zero($event_deadline)) echo "<li> Registration deadline for this ".$word." is <b>".date("l, F j, Y",$event_deadline)."</b>\n";
if (!$logged) {
echo "<li> <b><span style=\"color:#DD0000\">You must be logged in to sign-up for this ".$word.". Use the form at the top right of this page to login.</span></b>\n";
} else {
//echo "<li> The ".($word=="event"?"events":"classes")." in which you are registered for are listed in <b style=\"background:#D5EFFF;\">bold font with light blue background</b>.\n";
if (($event_emponly == 1) || ($event_emponly == 3)) echo "<li> If you wish to <b style=\"color:#DD0000;\">REMOVE</b> yourself from ".($word=="event"?"an event":"a class").", simply click on the <b style=\"text-decoration:underline;color:#DD0000;\">Remove</b> link.\n";
else echo "<li> If you wish to <b style=\"color:#DD0000;\">REMOVE</b> an attendee from ".($word=="event"?"an event":"a class").", you can do so in the <a href=\"#\">View List</a> popup window.\n";
}
echo "</ul>\n";
if (isset($_GET["er"])) echo "<br><br>".error(base64_decode($_GET["er"]));
else if (isset($_GET["ty"])) echo "<br><br>".thankyou(base64_decode($_GET["ty"]));
echo "<br><br><center><table width=96% border=0 cellspacing=0 cellpadding=4 style=\"border:solid 1px #999999;\">\n";
echo "<tr class=\"header\"><td>".ucfirst($word)." <span style=\"font-size:10px;\">(Click Title for Description)</span></td>".($logged?"<td align=\"center\">Register</td><td align=\"center\">Attendees</td>":"")."</tr>\n";
for ($i=0; $i < mysql_num_rows($res); $i++) {
$k = mysql_fetch_array($res);
$isatt_ct = quickSQL("SELECT COUNT(isatt_id) FROM tbl_event_is_att WHERE eis_id=".$k["eis_id"]);
if (($event_emponly == 1) || ($event_emponly == 3)) $isatt_id = quickSQL("SELECT isatt_id FROM tbl_event_is_att WHERE eis_id=".$k["eis_id"]." AND registrant='".$_SESSION["auth_user"]."'");
else $isatt_id = quickSQL("SELECT COUNT(isatt_id) FROM tbl_event_is_att WHERE eis_id=".$k["eis_id"]." AND registrant='".$_SESSION["auth_user"]."'");
if ($logged && !zero($isatt_id) ? $bold=TRUE : $bold=FALSE);
echo "<tr bgcolor=\"".($bold?"#D5EFFF":($i%2==0?"#F0F0F0":"#FFFFFF"))."\"".($bold?" style=\"font-weight:bold\"":"").">\n";
echo "<td><a href=\"javascript:ToggleRow('desc".$k["eis_id"]."')\">".$k["eis_title"]."</a></td>\n";
if ($logged) {
if (!$bold && (($event_emponly == 1) || ($event_emponly == 3))) echo "<td align=\"center\"><a href=\"javascript:confirm_register(".$k["eis_id"].")\">Register</a></td>\n";
else if ($bold && (($event_emponly == 1) || ($event_emponly == 3))) echo "<td align=\"center\"><a href=\"javascript:confirm_unregister(".$isatt_id.")\" style=\"color:#DD0000;\">Remove</a></td>\n";
else if (($event_emponly == 2) || ($event_emponly == 4)) echo "<td align=\"center\"><a href=\"#\" onClick=\"openWindow('/eventreg_confirm.php?id=".$k["eis_id"]."&t=is','','resizable=yes,width=350,height=235')\">Register</a></td>\n";
echo "<td align=\"center\"><a href=\"#\" onClick=\"openWindow('eventreg_is_list.php?sid=".$k["eis_id"]."','','scrollbars=yes,resizable=yes,width=350,height=400')\">View List (".$isatt_ct.")</a></td>\n";
}
echo "</tr>\n";
echo "<tbody id=\"desc".$k["eis_id"]."\" style=\"display:none\">\n";
echo "<tr bgcolor=\"".($bold?"#D5EFFF":($i%2==0?"#F0F0F0":"#FFFFFF"))."\">\n";
echo "<td colspan=8><span style=\"font-size:10px\">".(zero($k["eis_desc"])?"No Description":format_body($k["eis_desc"],0))."</span></td>\n";
echo "</tr>\n";
echo "</tbody>\n";
}
echo "</table></center>\n";
} else if ($event_active == 0) {
echo "<br><br><br><ul><li> <b><span style=\"color:#DD0000\">Sorry, but the owner of this ".$word." is not accepting registrations at this time.</span></b>\n";
} else {
echo "<br><br><br><ul><li> <b><span style=\"color:#DD0000\">Sorry, but the deadline for ".$word." registrations was ".date("l, F j, Y",$event_deadline)."</span></b>\n";
}
if (authorize($event_owner)) echo "<P><table><tr><td><img src=\"gui/edit.gif\" border=0></td><td><a href=\"event_new_is.php?id=".$_GET["id"]."\">Edit ".($word=="event"?"events":"classes")."</a></td><td>| <a href=\"event_new.php?type=is&id=".$_GET["id"]."\">Edit header information</a></td><td>| <a href=\"/eventadmin_is.php?id=".$_GET["id"]."\" target=\"blank\">Manage Attendees</a></td></tr></table>";
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=".$event_owner."\">".$event_owner."</a></div>Content Owner: <a href=\"/profile.php?u=".$event_owner."\">".$event_owner."</a></div>\n";
include("_pageend.php");
?>