";
if ($usernameunique_err) format_message(1,"User name already exists.");
if ($fnamesuppld_err) format_message(1,"First name cannot be blank.");
if ($lnamesuppld_err) format_message(1,"Last name cannot be blank.");
if ($loginsuppld_err) format_message(1,"Login cannot be blank.");
if ($loginunique_err) format_message(1,"Login already exists.");
if ($passcomplex_err) format_message(1,"Password doesn't meet complexity requirements.");
if ($passmatch_err) format_message(1,"The supplied passwords don't match.");
if ($userhaswriteups_err) format_message(1,"User has actions in the database and cannot be deleted.");
if ($edit_user && !$delete_user) {
// set form options for editing
$sectiontitle="Modify UserClick here to add a new user
";
$formtag="
";
// show the table of entities
$existingdata=mysqli_query($drs_db,"select id,firstname,lastname,login,role,active from users order by id asc");
echo "
Existing Users Click on the User ID to edit.
User ID
First Name
Last Name
Login
Role
Active
";
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
if ($tablerow["role"]==ADMIN) {
$roledef="Admin";
} elseif ($tablerow["role"]==USER) {
$roledef="User";
}
if ($tablerow["active"]) {
$activedef="";
} else {
$activedef="";
}
printf("
";
if ($devicenameunique_err) format_message(1,"Device name already exists.");
if ($devicenamesuppld_err) format_message(1,"Device name cannot be blank.");
if ($devicehaswriteups_err) format_message(1,"Device has writeups in the database and cannot be deleted.");
if ($edit_device && !$delete_device) {
// set form options for editing
$sectiontitle="Modify DeviceClick here to add a new device
";
$formtag="
";
// show the table of entities
$existingdata=mysqli_query($drs_db,"select * from devices order by id asc");
echo "
Existing Devices Click on the Device ID to edit.
Device ID
Device Name
Active
";
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
if ($tablerow["active"]) {
$activedef="";
} else {
$activedef="";
}
printf("
";
if ($ssnameunique_err) format_message(1,"Subsystem name already exists.");
if ($ssnamesuppld_err) format_message(1,"Subsystem name cannot be blank.");
if ($sshaswriteups_err) format_message(1,"Subsystem has writeups in the database and cannot be deleted.");
if ($edit_subsystem && !$delete_subsystem) {
// set form options for editing
$sectiontitle="Modify SubsystemClick here to add a new subsystem
";
$formtag="
";
// show the table of entities
$existingdata=mysqli_query($drs_db,"select * from subsystems order by id asc");
echo "
Existing Subsystems Click on the Subsystem ID to edit.
Subsystem ID
Subsystem Name
Description
Active
";
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
if ($tablerow["active"]) {
$activedef="";
} else {
$activedef="";
}
printf("
";
if ($reastextunique_err) format_message(1,"Reason already exists.");
if ($reastextsuppld_err) format_message(1,"Reason cannot be blank.");
if ($reashaswriteups_err) format_message(1,"Reason has writeups in the database and cannot be deleted.");
if ($edit_reason && !$delete_reason) {
// set form options for editing
$sectiontitle="Modify ReasonClick here to add a new reason
";
$formtag="
";
// show the table of entities
$existingdata=mysqli_query($drs_db,"select * from reasons order by id asc");
echo "
Existing Reasons Click on the Reason ID to edit.
Reason ID
Reason Text
Active
";
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
if ($tablerow["active"]) {
$activedef="";
} else {
$activedef="";
}
printf("
";
if ($peridisint_err) format_message(1,"Period number must be an integer.");
if ($peridsuppld_err) format_message(1,"Period number cannot be blank.");
if ($peridunique_err) format_message(1,"Period number already exists.");
if ($pertimesunique_err) format_message(1,"Period already exists.");
if ($pertimessuppld_err) format_message(1,"Period times cannot be blank.");
if ($perhaswriteups_err) format_message(1,"Period has writeups in the database and cannot be deleted.");
if ($edit_period && !$delete_period) {
// set form options for editing
$sectiontitle="Modify PeriodClick here to add a new period
";
$formtag="
";
// show the table of entities
$existingdata=mysqli_query($drs_db,"select * from periods order by id asc");
echo "
Existing Periods Click on the Period ID to edit.
Period ID
Period Times
Active
";
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
if ($tablerow["active"]) {
$activedef="";
} else {
$activedef="";
}
printf("