File: /home/awaldron/www/archive/demo/eventreg_confirm.php
<?php
session_start();
?>
<html>
<head>
<title>Confirm Registration</title>
</head>
<link rel="stylesheet" type="text/css" href="default.css">
<?php
include("_functions.php");
if (!isset($_POST["submit"])) {
echo "<body style=\"margin:15px;font-size:12px;\">\n";
dbconnect();
$employee_type = quickSQL("SELECT emp_type_id FROM tbl_employees WHERE username='".$_SESSION["auth_user"]."'");
if ($_GET["t"] == "su") {
$sql = "SELECT * FROM tbl_event as A, tbl_event_su as B WHERE B.event_id=A.event_id AND B.esu_id=".$_GET["id"];
$result = mysql_query($sql);
extract(mysql_fetch_array($result));
echo "<P><span class=\"subhead\">".$esu_title."</span>\n";
echo "<br><b>".date("h:i a",$esu_start)." - ".date("h:i a",$esu_end)."</b>\n";
if (($employee_type > 3) && (($event_emponly == 1) || ($event_emponly == 2))) {
echo "<P>".error("Sorry, but this event is only open to Vocollect employees.");
} else {
echo "<P><b style=\"color:#009900;\">Click the 'Register' button to confirm.</b>\n";
echo "<form action=\"".self()."\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"registrant\" value=\"".$_SESSION["auth_user"]."\">\n";
echo "<input type=\"hidden\" name=\"esu_id\" value=\"".$_GET["id"]."\">\n";
echo "<P><center><table border=0 cellspacing=5 style=\"font-size:12px;\">\n";
echo "<tr><td>Registrant:</td><td><input type=\"text\" style=\"width:180;\" name=\"dummy_username\" value=\"".get_user($_SESSION["auth_user"],"fullname2")."\" DISABLED></td></tr>\n";
if (($event_emponly == 1) || ($event_emponly == 3)) {
echo "<input type=\"hidden\" name=\"attendee\" value=\"".get_user($_SESSION["auth_user"],"fullname2")."\">\n";
echo "<tr><td>Attendee:</td><td><input type=\"text\" style=\"width:150;\" name=\"dummy_attendee\" value=\"".get_user($_SESSION["auth_user"],"fullname2")."\" DISABLED></td></tr>\n";
} else if (($event_emponly == 2) || ($event_emponly == 4)) {
echo "<tr><td>Attendee:</td><td><input type=\"text\" style=\"width:150;\" name=\"attendee\" value=\"".get_user($_SESSION["auth_user"],"fullname2")."\"></td></tr>\n";
}
echo "<tr><td colspan=2 align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Register\"></td></tr>\n";
echo "</table>\n";
echo "</form>\n";
}
}
if ($_GET["t"] == "is") {
$sql = "SELECT * FROM tbl_event as A, tbl_event_is as B WHERE B.event_id=A.event_id AND B.eis_id=".$_GET["id"];
$result = mysql_query($sql);
extract(mysql_fetch_array($result));
echo "<P><span class=\"subhead\">".$eis_title."</span>\n";
echo "<br><b>No Dates Scheduled</b>\n";
if (($employee_type > 3) && (($event_emponly == 1) || ($event_emponly == 2))) {
echo "<P>".error("Sorry, but this event is only open to Vocollect employees.");
} else {
echo "<P><b style=\"color:#009900;\">Click the 'Register' button to confirm.</b>\n";
echo "<form action=\"".self()."\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"registrant\" value=\"".$_SESSION["auth_user"]."\">\n";
echo "<input type=\"hidden\" name=\"eis_id\" value=\"".$_GET["id"]."\">\n";
echo "<P><center><table border=0 cellspacing=5 style=\"font-size:12px;\">\n";
echo "<tr><td>Registrant:</td><td><input type=\"text\" style=\"width:180;\" name=\"dummy_username\" value=\"".get_user($_SESSION["auth_user"],"fullname2")."\" DISABLED></td></tr>\n";
if (($event_emponly == 1) || ($event_emponly == 3)) {
echo "<input type=\"hidden\" name=\"attendee\" value=\"".get_user($_SESSION["auth_user"],"fullname2")."\">\n";
echo "<tr><td>Attendee:</td><td><input type=\"text\" style=\"width:150;\" name=\"dummy_attendee\" value=\"".get_user($_SESSION["auth_user"],"fullname2")."\" DISABLED></td></tr>\n";
} else if (($event_emponly == 2) || ($event_emponly == 4)) {
echo "<tr><td>Attendee:</td><td><input type=\"text\" style=\"width:150;\" name=\"attendee\" value=\"".get_user($_SESSION["auth_user"],"fullname2")."\"></td></tr>\n";
}
echo "<tr><td colspan=2 align=\"center\"><input type=\"submit\" name=\"submit\" value=\"Register\"></td></tr>\n";
echo "</table>\n";
echo "</form>\n";
}
}
} else {
dbconnect();
if ($_GET["t"] == "su") $sql = "INSERT INTO tbl_event_su_att (esu_id,attendee,registrant,att_time) VALUES (".$_POST["esu_id"].",'".$_POST["attendee"]."','".$_POST["registrant"]."',".time().")";
if ($_GET["t"] == "is") $sql = "INSERT INTO tbl_event_is_att (eis_id,attendee,registrant,att_time) VALUES (".$_POST["eis_id"].",'".$_POST["attendee"]."','".$_POST["registrant"]."',".time().")";
if (quickUPDATE($sql) !== FALSE) {
echo "<body style=\"margin:15px;font-size:12px;\" onLoad=\"window.opener.location.reload();window.close();\">\n";
echo "<script>document.writeln(opener.location);</script>";
} else {
echo "<body style=\"margin:15px;font-size:12px;\">\n";
echo error("There was an error when attempting to make the change.");
//echo "<P>".$sql;
}
}
?>
</body>
</html>