Tech name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\""))) { $nameunique = FALSE; echo " Tech name already exists.
"; } else { $nameunique = TRUE; } // test for matching passwords if ($pass == $passconf) { $passmatch = TRUE; $passhash = password_hash($pass, PASSWORD_DEFAULT); } else { $passmatch = FALSE; echo " The passwords you supplied don't match.
"; } if ($namesuppld && $nameunique && $passmatch) { // modify the table $addqry = ("insert into techs(techname,admin,shift,techpass,status) values(\"$name\",\"$admin\",\"$shift\",\"$passhash\",\"$active\")"); mysqli_query($db, $addqry); } break; case "shifts": if ($active) $active = 1; else $active = 0; // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Shift name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select shiftid from shifts where shiftname=\"$name\""))) { $nameunique = FALSE; echo " Shift name already exists.
"; } else { $nameunique = TRUE; } if ($namesuppld && $nameunique) { // modify the table $addqry = ("insert into shifts(shiftname,status) values(\"$name\",\"$active\")"); mysqli_query($db, $addqry); } break; case "subjects": if ($active) $active = 1; else $active = 0; // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Subject name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select subjectid from subjects where subjectname=\"$name\""))) { $nameunique = FALSE; echo " Subject name already exists.
"; } else { $nameunique = TRUE; } if ($namesuppld && $nameunique) { // modify the table $addqry = ("insert into subjects(subjectname,status) values(\"$name\",\"$active\")"); mysqli_query($db, $addqry); } break; case "links": if ($active) $active = 1; else $active = 0; // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Display text cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select linkid from links where displaytxt=\"$name\""))) { $nameunique = FALSE; echo " Display text already exists.
"; } else { $nameunique = TRUE; } // test for urltxt supplied if (strlen(trim($url))) { $urlsuppld = TRUE; } else { $urlsuppld = FALSE; echo " URL text cannot be blank.
"; } if ($namesuppld && $nameunique && $urlsuppld) { // bump entries with linkpriority higher than belowlink up by one if necessary $mypriority = $belowlink + 1; if (mysqli_num_rows(mysqli_query($db, "select linkpriority from links where linkpriority=\"$mypriority\""))) { mysqli_query($db, "update links set linkpriority=linkpriority+1 where linkpriority>\"$belowlink\""); } // insert the link mysqli_query($db, "insert into links(linkpriority,displaytxt,urltxt,status) values(\"$mypriority\",\"$name\",\"$url\",\"$active\")"); } break; case "flags": if ($active) $active = 1; else $active = 0; // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Flag name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagname=\"$name\""))) { $nameunique = FALSE; echo " Flag name already exists.
"; } else { $nameunique = TRUE; } // test for symbol supplied if (strlen(trim($flagsym))) { $symsuppld = TRUE; } else { $symsuppld = FALSE; echo " Flag symbol cannot be blank.
"; } // test for symbol unique if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagsym=\"$flagsym\""))) { $symunique = FALSE; echo " Flag symbol already exists.
"; } else { $symunique = TRUE; } if ($namesuppld && $nameunique && $symsuppld && $symunique) { // insert record in flags table mysqli_query($db, "insert into flags(flagname,flagsym,flagcolor,status) values(\"$name\",\"$flagsym\",\"$flagcolor\",\"$active\")"); } break; case "logpartactions": if ($active) $active = 1; else $active = 0; // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Part Action name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select lpactionid from logpartactions where lpactionname=\"$name\""))) { $nameunique = FALSE; echo " Part Action name already exists.
"; } else { $nameunique = TRUE; } if ($namesuppld && $nameunique) { // modify the table $addqry = ("insert into logpartactions(lpactionname,status) values(\"$name\",\"$active\")"); mysqli_query($db, $addqry); } break; case "banners": // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Banner name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select bannerid from banners where bannername=\"$name\""))) { $nameunique = FALSE; echo " Banner name already exists.
"; } else { $nameunique = TRUE; } if ($namesuppld && $nameunique) { // modify the table $addqry = ("insert into banners(bannername,bannercolor,textcolor) values(\"$name\",\"$bnrcolor\",\"$bnrtxtcolor\")"); mysqli_query($db, $addqry); } break; default: framework("begin", "$logname Administration", "Error", $print); echo "unknown table"; framework("end", "", "", $print); exit(); } } if ($edit) { switch ($table) { case "techs": if ($admin) $admin = 1; else $admin = 0; if ($active) $active = 1; else $active = 0; if ($delete) { // check for log notes by this tech if (mysqli_num_rows(mysqli_query($db, "select lognoteid from lognotes where tech=\"$id\""))) { $hasnotes = TRUE; echo " Tech has notes in logbook and cannot be deleted.
"; } else { $hasnotes = FALSE; } // check for maintenance forms by this tech if (mysqli_num_rows(mysqli_query($db, "select maintformid from maintforms where mftech=\"$id\""))) { $hasmfs = TRUE; echo " Tech has maintenance forms and cannot be deleted.
"; } else { $hasmfs = FALSE; } // check for maintenance actions by this tech if (mysqli_num_rows(mysqli_query($db, "select maintactionid from maintactions where actiontech=\"$id\""))) { $hasmas = TRUE; echo " Tech has maintenance actions and cannot be deleted.
"; } else { $hasmas = FALSE; } if (!$hasnotes && !$hasmfs && !$hasmas) { // delete entity mysqli_query($db, "delete from techs where techid=\"$id\""); } } if ($update) { // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Tech name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\" and techid!=\"$id\""))) { if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\""))) { $nameunique = FALSE; echo " Tech name already exists.
"; } else { $nameunique = TRUE; } } else { $nameunique = TRUE; } // test for matching passwords if ($pass != "password_is_unchanged") { if ($pass == $passconf) { $passmatch = TRUE; $passhash = password_hash($pass, PASSWORD_DEFAULT); $updqry = ("update techs set techname=\"$name\",admin=\"$admin\",shift=\"$shift\",techpass=\"$passhash\",status=\"$active\" where techid=\"$id\""); } else { $passmatch = FALSE; echo " The passwords you supplied don't match.
"; } } else { $passmatch = TRUE; $updqry = "update techs set techname=\"$name\",admin=\"$admin\",shift=\"$shift\",status=\"$active\" where techid=\"$id\""; } if ($namesuppld && $nameunique && $passmatch) { // modify the table mysqli_query($db, $updqry); } } break; case "shifts": if ($active) $active = 1; else $active = 0; if ($delete) { // check for log notes with this shift if (mysqli_num_rows(mysqli_query($db, "select lognoteid from lognotes where shift=\"$id\""))) { $hasnotes = TRUE; echo " Shift has notes in logbook and cannot be deleted.
"; } else { $hasnotes = FALSE; } if (!$hasnotes) { // delete entity mysqli_query($db, "delete from shifts where shiftid=\"$id\""); } } if ($update) { // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Shift name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select shiftid from shifts where shiftname=\"$name\" and shiftid!=\"$id\""))) { if (mysqli_num_rows(mysqli_query($db, "select shiftid from shifts where shiftname=\"$name\""))) { $nameunique = FALSE; echo " Shift name already exists.
"; } else { $nameunique = TRUE; } } else { $nameunique = TRUE; } if ($namesuppld && $nameunique) { // modify the table mysqli_query($db, "update shifts set shiftname=\"$name\",status=\"$active\" where shiftid=\"$id\""); } } break; case "subjects": if ($active) $active = 1; else $active = 0; if ($delete) { // check for log notes with this subject if (mysqli_num_rows(mysqli_query($db, "select lognoteid from lognotes where subject=\"$id\""))) { $hasnotes = TRUE; echo " Subject has notes in logbook and cannot be deleted.
"; } else { $hasnotes = FALSE; } if (!$hasnotes) { // delete entity mysqli_query($db, "delete from subjects where subjectid=\"$id\""); } } if ($update) { // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Subject name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select subjectid from subjects where subjectname=\"$name\" and subjectid!=\"$id\""))) { if (mysqli_num_rows(mysqli_query($db, "select subjectid from subjects where subjectname=\"$name\""))) { $nameunique = FALSE; echo " Subject name already exists.
"; } else { $nameunique = TRUE; } } else { $nameunique = TRUE; } if ($namesuppld && $nameunique) { // modify the table mysqli_query($db, "update subjects set subjectname=\"$name\",status=\"$active\" where subjectid=\"$id\""); } } break; case "links": if ($active) $active = 1; else $active = 0; if ($delete) { mysqli_query($db, "delete from links where linkid=\"$id\""); } if ($update) { // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Display text cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select linkid from links where displaytxt=\"$name\" and linkid!=\"$id\""))) { if (mysqli_num_rows(mysqli_query($db, "select linkid from links where displaytxt=\"$name\""))) { $nameunique = FALSE; echo " Display text already exists.
"; } else { $nameunique = TRUE; } } else { $nameunique = TRUE; } // test for urltxt supplied if (strlen(trim($url))) { $urlsuppld = TRUE; } else { $urlsuppld = FALSE; echo " URL text cannot be blank.
"; } if ($namesuppld && $nameunique && $urlsuppld) { // bump entries with linkpriority higher than belowlink up by one if necessary $mypriority = $belowlink + 1; if (mysqli_num_rows(mysqli_query($db, "select linkpriority from links where linkpriority=\"$mypriority\""))) { mysqli_query($db, "update links set linkpriority=linkpriority+1 where linkpriority>\"$belowlink\""); } // update the link mysqli_query($db, "update links set linkpriority=\"$mypriority\",displaytxt=\"$name\",urltxt=\"$url\",status=\"$active\" where linkid=\"$id\""); } } break; case "flags": if ($active) $active = 1; else $active = 0; if ($delete) { // check for things using this flag if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$id\""))) { $used = TRUE; echo " Flag is used by other tables and cannot be deleted.
"; } else { $used = FALSE; } if (!$used) { // delete entity mysqli_query($db, "delete from flags where flagid=\"$id\""); } } if ($update) { // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Flag name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagname=\"$name\" and flagid!=\"$id\""))) { if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagname=\"$name\""))) { $nameunique = FALSE; echo " Flag name already exists.
"; } else { $nameunique = TRUE; } } else { $nameunique = TRUE; } // test for symbol supplied if (strlen(trim($flagsym))) { $symsuppld = TRUE; } else { $symsuppld = FALSE; echo " Flag symbol cannot be blank.
"; } // test for symbol unique if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagsym=\"$flagsym\" and flagid!=\"$id\""))) { if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagsym=\"$flagsym\""))) { $symunique = FALSE; echo " Flag symbol already exists.
"; } else { $symunique = TRUE; } } else { $symunique = TRUE; } if ($namesuppld && $nameunique && $symsuppld && $symunique) { // modify the table mysqli_query($db, "update flags set flagname=\"$name\",flagsym=\"$flagsym\",flagcolor=\"$flagcolor\",status=\"$active\" where flagid=\"$id\""); } } break; case "logpartactions": if ($active) $active = 1; else $active = 0; if ($delete) { // check for logparts with this part action if (mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where action=\"$id\""))) { $hasparts = TRUE; echo " Action is assigned to parts in logbook notes and cannot be deleted.
"; } else { $hasparts = FALSE; } if (!$hasparts) { // delete entity mysqli_query($db, "delete from logpartactions where lpactionid=\"$id\""); } } if ($update) { // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Part Action name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select lpactionid from logpartactions where lpactionname=\"$name\" and lpactionid!=\"$id\""))) { if (mysqli_num_rows(mysqli_query($db, "select lpactionid from logpartactions where lpactionname=\"$name\""))) { $nameunique = FALSE; echo " Part Action name already exists.
"; } else { $nameunique = TRUE; } } else { $nameunique = TRUE; } if ($namesuppld && $nameunique) { // modify the table mysqli_query($db, "update logpartactions set lpactionname=\"$name\",status=\"$active\" where lpactionid=\"$id\""); } } break; case "banners": if ($delete) { // delete entity mysqli_query($db, "delete from banners where bannerid=\"$id\""); } if ($update) { // do error checking // test for name supplied if (strlen(trim($name))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Banner name cannot be blank.
"; } // test for name unique if (mysqli_num_rows(mysqli_query($db, "select bannerid from banners where bannername=\"$name\" and bannerid!=\"$id\""))) { if (mysqli_num_rows(mysqli_query($db, "select bannerid from banners where bannername=\"$name\""))) { $nameunique = FALSE; echo " Banner name already exists.
"; } else { $nameunique = TRUE; } } else { $nameunique = TRUE; } if ($namesuppld && $nameunique) { // modify the table mysqli_query($db, "update banners set bannername=\"$name\",bannercolor=\"$bnrcolor\",textcolor=\"$bnrtxtcolor\" where bannerid=\"$id\""); } } break; case "configs": switch ($type) { case "display": if ($display_showts) $display_showts = 1; else $display_showts = 0; if ($display_techalpha == "a") $display_techalpha = 1; else $display_techalpha = 0; if ($display_subjalpha == "a") $display_subjalpha = 1; else $display_subjalpha = 0; // test for logname supplied if (strlen(trim($display_logname))) { $namesuppld = TRUE; } else { $namesuppld = FALSE; echo " Log name cannot be blank.
"; } // test for urlchunk supplied if (strlen(trim($display_urlchunk))) { $chunksuppld = TRUE; } else { $chunksuppld = FALSE; echo " URL chunk size cannot be blank.
"; } if ($namesuppld && $chunksuppld) { mysqli_query($db, "update configs set confvalue=\"$display_logname\" where confname=\"log_name\""); mysqli_query($db, "update configs set confvalue=\"$display_urlchunk\" where confname=\"url_chunk_size\""); mysqli_query($db, "update configs set confvalue=\"$display_banner\" where confname=\"banner\""); mysqli_query($db, "update configs set confvalue=\"$display_footer\" where confname=\"footer_message\""); mysqli_query($db, "update configs set confvalue=\"$display_showts\" where confname=\"show_ts\""); mysqli_query($db, "update configs set confvalue=\"$display_techalpha\" where confname=\"tech_alpha\""); mysqli_query($db, "update configs set confvalue=\"$display_subjalpha\" where confname=\"subj_alpha\""); mysqli_query($db, "update configs set confvalue=\"$display_logstyle\" where confname=\"log_style\""); mysqli_query($db, "update configs set confvalue=\"$display_uidtext\" where confname=\"uid_text\""); } break; case "color": $hexcolor = "#" . ltrim($hexcolor); mysqli_query($db, "update configs set confvalue=\"$hexcolor\" where confname=\"$modcolor\""); break; case "misc": if ($misc_partfuncs) { mysqli_query($db, "update configs set confvalue=\"1\" where confname=\"parts_functions\""); } else { mysqli_query($db, "update configs set confvalue=\"0\" where confname=\"parts_functions\""); } if ($misc_logoutall) { if ($ostype == 'WIN') { $sessfileloc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"win_server_session_dir\""))[0]; } else { $sessfileloc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"unix_server_session_dir\""))[0]; } foreach (glob($sessfileloc . "/*") as $sessfile) { unlink($sessfile); } } if ($misc_schedmaintfuncs) { mysqli_query($db, "update configs set confvalue=\"1\" where confname=\"schedmaint_functions\""); } else { mysqli_query($db, "update configs set confvalue=\"0\" where confname=\"schedmaint_functions\""); } // test for sessttl supplied if (strlen(trim($misc_sessttl))) { $ttlsuppld = TRUE; } else { $ttlsuppld = FALSE; echo " Session expiration time cannot be blank.
"; } // test for sessdir supplied if (strlen(trim($misc_sessdir))) { $dirsuppld = TRUE; } else { $dirsuppld = FALSE; echo " Server session file directory cannot be blank.
"; } if ($ttlsuppld && $dirsuppld) { mysqli_query($db, "update configs set confvalue=\"$misc_sessttl\" where confname=\"session_ttl_days\""); if ($ostype == 'WIN') { mysqli_query($db, "update configs set confvalue=\"$misc_sessdir\" where confname=\"win_server_session_dir\""); } else { mysqli_query($db, "update configs set confvalue=\"$misc_sessdir\" where confname=\"unix_server_session_dir\""); } } break; default: echo "Unknown config type!"; break; } break; default: framework("begin", "$logname Administration", "Error", $print); echo "unknown table"; framework("end", "", "", $print); exit(); } } // ******** end database manipulation ******** } // show help echo "
Changes made here are global and affect all users. You must have admin privileges to make changes to these settings. To set your personal preferences, you should use the My Profile page. "; sidemenu(); pageblock("left", "end"); } pageblock("right", "begin"); banner($print); // show the menu of tables echo "
Techs Shifts Subjects Links Flags Part Actions
Banners Display Options Page Colors Miscellaneous Options

"; switch ($table) { case "techs": if ($isadmin) { // show the form if ($edit) { // set form options for editing $sectiontitle = "Modify Tech

"; $formtag = "
"; $buttontags = "          
"; // pull current values from database $currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from techs where techid=$id")); $name = $currentvalues["techname"]; $pass = $passconf = "password_is_unchanged"; $shift = $currentvalues["shift"]; if ($currentvalues["admin"] == 1) { $admintag = ""; } else { $admintag = ""; } if ($currentvalues["status"] == 1) { $activetag = ""; } else { $activetag = ""; } } else { // set form options for add $sectiontitle = "Add New Tech

"; $formtag = ""; $buttontags = " "; // set default values $admintag = ""; $activetag = ""; } echo " $sectiontitle $formtag
Tech Name (first and last name):  

Password:  

Repeat Password:  

Need a random password?   "; $rpw = substr(str_shuffle(password_hash(microtime(), PASSWORD_DEFAULT)), 10, 12); echo "  $rpw

Shift:  

Admin:  $admintag     Active:   $activetag

$buttontags


"; } // show the table of entities $existingdata = mysqli_query($db, "select techid,techname,admin,shift,status from techs order by techid asc"); echo " Existing Techs   Click on the Tech ID to edit.

"; while ($tablerow = mysqli_fetch_assoc($existingdata)) { if ($tablerow["admin"]) { $admdef = "\"admin\""; } else { $admdef = "\"not"; } if ($tablerow["status"]) { $statdef = "\"active\""; } else { $statdef = "\"inactive\""; } $shiftname = dblookup($db, "shifts", "shiftid", "shiftname", $tablerow["shift"]); printf( " ", $tablerow["techid"], $tablerow["techid"], $tablerow["techname"], $shiftname, $admdef, $statdef ); } echo "
Tech IDTech NameShiftAdminActive
%s %s %s %s %s
"; break; case "shifts": if ($isadmin) { // show the form if ($edit) { // set form options for editing $sectiontitle = "Modify Shift

"; $formtag = "
"; $buttontags = "          
"; // pull current values from database $currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from shifts where shiftid=$id")); $name = $currentvalues["shiftname"]; if ($currentvalues["status"] == 1) { $activetag = ""; } else { $activetag = ""; } } else { // set form options for add $sectiontitle = "Add New Shift

"; $formtag = ""; $buttontags = " "; // set default values $activetag = ""; } echo " $sectiontitle $formtag
Shift Name (may contain spaces):  

Active:   $activetag

$buttontags


"; } // show the table of entities $existingdata = mysqli_query($db, "select shiftid,shiftname,status from shifts order by shiftid asc"); echo " Existing Shifts   Click on the Shift ID to edit.

"; while ($tablerow = mysqli_fetch_assoc($existingdata)) { if ($tablerow["status"]) { $statdef = "\"active\""; } else { $statdef = "\"inactive\""; } printf( " ", $tablerow["shiftid"], $tablerow["shiftid"], $tablerow["shiftname"], $statdef ); } echo "
Shift IDShift NameActive
%s %s %s
"; break; case "subjects": if ($isadmin) { // show the form if ($edit) { // set form options for editing $sectiontitle = "Modify Subject

"; $formtag = "
"; $buttontags = "          
"; // pull current values from database $currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from subjects where subjectid=$id")); $name = $currentvalues["subjectname"]; if ($currentvalues["status"] == 1) { $activetag = ""; } else { $activetag = ""; } } else { // set form options for add $sectiontitle = "Add New Subject

"; $formtag = ""; $buttontags = " "; // set default values $activetag = ""; } echo " $sectiontitle $formtag
Subject Name (may contain spaces):  

Active:  $activetag

$buttontags


"; } // show the table of entities $existingdata = mysqli_query($db, "select subjectid,subjectname,status from subjects order by subjectid asc"); echo " Existing Subjects   Click on the Subject ID to edit.

"; while ($tablerow = mysqli_fetch_assoc($existingdata)) { if ($tablerow["status"]) { $statdef = "\"active\""; } else { $statdef = "\"inactive\""; } printf( " ", $tablerow["subjectid"], $tablerow["subjectid"], $tablerow["subjectname"], $statdef ); } echo "
Subject IDSubject NameActive
%s %s %s
"; break; case "links": if ($isadmin) { // show the form if ($edit) { // set form options for editing $sectiontitle = "Modify Link

"; $formtag = "
"; $buttontags = "          
"; // pull current values from database $currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from links where linkid=$id")); $name = $currentvalues["displaytxt"]; $priority = $currentvalues["linkpriority"]; $url = $currentvalues["urltxt"]; if ($currentvalues["status"] == 1) { $activetag = ""; } else { $activetag = ""; } // determine where we are in the priority stack $prow = mysqli_fetch_assoc(mysqli_query($db, "select min(linkpriority) as highest from links")); if ($prow["highest"] == $priority) { $belowselection = 0; } else { $abovelink = mysqli_fetch_row(mysqli_query($db, "select max(linkpriority) from links where linkpriority<\"$priority\"")); $belowselection = $abovelink[0]; } $priorselect = ""; } else { // set form options for add $sectiontitle = "Add New Link

"; $formtag = ""; $buttontags = " "; // set default values $abovelink = mysqli_fetch_row(mysqli_query($db, "select max(linkpriority) from links")); $belowselection = $abovelink[0]; $priorselect = ""; $activetag = ""; } echo " $sectiontitle $formtag
Link Name (what the user will click on):  

URL (page the link takes you to. Must be a valid URL.):  

Insert Link Below:   $priorselect

Active:  $activetag

$buttontags


"; } // show the table of entities $existingdata = mysqli_query($db, "select linkid,displaytxt,urltxt,status from links order by linkpriority asc"); echo " Existing Links   Click on the Link ID to edit.

"; while ($tablerow = mysqli_fetch_assoc($existingdata)) { if ($tablerow["status"]) { $statdef = "\"active\""; } else { $statdef = "\"inactive\""; } printf( " ", $tablerow["linkid"], $tablerow["linkid"], $tablerow["displaytxt"], $tablerow["urltxt"], $tablerow["urltxt"], $statdef ); } echo "
Link IDDisplay TextURLActive
%s %s %s %s
"; break; case "flags": if ($isadmin) { // show the form if ($edit) { // set form options for editing $sectiontitle = "Modify Flag

"; $formtag = "
"; $buttontags = "          
"; // pull current values from database $currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=$id")); $name = $currentvalues["flagname"]; $flagsym = $currentvalues["flagsym"]; $flagcolor = $currentvalues["flagcolor"]; $flagcoloropts = ""; foreach ($basic_colors as $cname => $chex) { if ($chex == $flagcolor) { $flagcoloropts = $flagcoloropts . ""; } else { $flagcoloropts = $flagcoloropts . ""; } } if ($currentvalues["status"] == 1) { $activetag = ""; } else { $activetag = ""; } } else { // set form options for add $sectiontitle = "Add New Flag

"; $formtag = ""; $buttontags = " "; // set default values $flagcolor = "#FFFFFF"; $flagcoloropts = ""; foreach ($basic_colors as $cname => $chex) { if ($chex == $flagcolor) { $flagcoloropts = $flagcoloropts . ""; } else { $flagcoloropts = $flagcoloropts . ""; } } $activetag = ""; } echo " $sectiontitle $formtag
Flag Name (may contain spaces):  

Flag Symbol (one, two, three, or four letter mnemonic to be shown in tables and lists):  

Flag Color (symbol will be shown in this color):  

Active:  $activetag

$buttontags


"; } // show the table of entities $existingdata = mysqli_query($db, "select * from flags order by flagid asc"); echo " Existing Flags   Click on the Flag ID to edit.

"; while ($tablerow = mysqli_fetch_assoc($existingdata)) { if ($tablerow["status"]) { $statdef = "\"active\""; } else { $statdef = "\"inactive\""; } printf( " ", $tablerow["flagid"], $tablerow["flagid"], $tablerow["flagname"], $tablerow["flagcolor"], $tablerow["flagsym"], $statdef ); } echo "
Flag IDFlag NameFlag SymbolActive
%s %s %s %s
"; break; case "logpartactions": if ($isadmin) { // show the form if ($edit) { // set form options for editing $sectiontitle = "Modify Part Action

"; $formtag = "
"; $buttontags = "          
"; // pull current values from database $currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from logpartactions where lpactionid=$id")); $name = $currentvalues["lpactionname"]; if ($currentvalues["status"] == 1) { $activetag = ""; } else { $activetag = ""; } } else { // set form options for add $sectiontitle = "Add New Part Action

"; $formtag = ""; $buttontags = " "; // set default values $activetag = ""; } echo " $sectiontitle $formtag
Part Action Name (may contain spaces):  

Active:  $activetag

$buttontags


"; } // show the table of entities $existingdata = mysqli_query($db, "select * from logpartactions order by lpactionid asc"); echo " Existing Part Actions   Click on the Action ID to edit.

"; while ($tablerow = mysqli_fetch_assoc($existingdata)) { if ($tablerow["status"]) { $statdef = "\"active\""; } else { $statdef = "\"inactive\""; } printf( " ", $tablerow["lpactionid"], $tablerow["lpactionid"], $tablerow["lpactionname"], $statdef ); } echo "
Part Action IDPart Action NameActive
%s %s %s
"; break; case "banners": if ($isadmin) { // show the form if ($edit) { // set form options for editing $sectiontitle = "Modify Banner

"; $formtag = "
"; $buttontags = "          
"; // pull current values from database $currentvalues = mysqli_fetch_assoc(mysqli_query($db, "select * from banners where bannerid=$id")); $name = $currentvalues["bannername"]; $bnrcolor = $currentvalues["bannercolor"]; $bnrtextcolor = $currentvalues["textcolor"]; $bnrcoloropts = ""; foreach ($basic_colors as $cname => $chex) { if ($chex == $bnrcolor) { $bnrcoloropts = $bnrcoloropts . ""; } else { $bnrcoloropts = $bnrcoloropts . ""; } } $bnrtextcoloropts = ""; foreach ($basic_colors as $cname => $chex) { if ($chex == $bnrtextcolor) { $bnrtextcoloropts = $bnrtextcoloropts . ""; } else { $bnrtextcoloropts = $bnrtextcoloropts . ""; } } } else { // set form options for add $sectiontitle = "Add New Banner

"; $formtag = ""; $buttontags = " "; // set default values $bnrcolor = "#000000"; $bnrtextcolor = "#FFFFFF"; $bnrcoloropts = ""; foreach ($basic_colors as $cname => $chex) { if ($chex == $bnrcolor) { $bnrcoloropts = $bnrcoloropts . ""; } else { $bnrcoloropts = $bnrcoloropts . ""; } } $bnrtextcoloropts = ""; foreach ($basic_colors as $cname => $chex) { if ($chex == $bnrtextcolor) { $bnrtextcoloropts = $bnrtextcoloropts . ""; } else { $bnrtextcoloropts = $bnrtextcoloropts . ""; } } } echo " $sectiontitle $formtag
Banner Name (text displayed in the banner):  

Banner Color (background color of the banner):  

Banner Text Color (text color of the banner, different than banner color):  

$buttontags


"; } // show the table of entities $existingdata = mysqli_query($db, "select * from banners where bannerid!=1 order by bannerid asc"); echo " Existing Banners   Click on the Banner ID to edit.

"; while ($tablerow = mysqli_fetch_assoc($existingdata)) { printf( " ", $tablerow["bannerid"], $tablerow["bannerid"], $tablerow["bannercolor"], $tablerow["textcolor"], $tablerow["bannername"] ); } echo "
Banner IDBanner
%s %s
"; break; case "configs": switch ($type) { case "display": $curlname = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"log_name\""))[0]; $curlchunk = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"url_chunk_size\""))[0]; $curbnr = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"banner\""))[0]; $curftr = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"footer_message\""))[0]; $curts = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"show_ts\""))[0]; $curtdo = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"tech_alpha\""))[0]; $cursdo = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"subj_alpha\""))[0]; $curlogstyle = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"log_style\""))[0]; $curuidtxt = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"uid_text\""))[0]; echo "
Display Configuration Parameters


Log Name (will appear at the top of pages and in the titlebar):  

Banner (will appear at the top and bottom of pages):  

Footer Message (will appear at the bottom of pages):


UID text (what you'd like to call the Unique Part ID):


Log style (the look of the log notes display):   

URL Chunk Size (long URLs will be linewrapped at this many characters):  

Show timestamps in log notes:    "; if ($curts) { echo ""; } else { echo ""; } echo "

Techs display order:    "; if ($curtdo) { echo " Alphabetical order      Database order "; } else { echo " Alphabetical order      Database order "; } echo "

Subjects display order:    "; if ($cursdo) { echo " Alphabetical order      Database order "; } else { echo " Alphabetical order      Database order "; } echo "


"; if ($isadmin) { echo "     
"; } echo "


"; break; case "color": $curbgc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"background_color\""))[0]; $cursbc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"sidebar_color\""))[0]; $curmbgc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"menubg_color\""))[0]; $curtc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"text_color\""))[0]; $curlc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"link_color\""))[0]; $curvlc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"vlink_color\""))[0]; $curhc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"heading_color\""))[0]; switch ($modcolor) { case "background_color": echo "
Page background color"; colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=background_color&hexcolor="); echo "

"; break; case "sidebar_color": echo "
Sidebar color"; colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=sidebar_color&hexcolor="); echo "

"; break; case "menubg_color": echo "
Menu background color"; colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=menubg_color&hexcolor="); echo "

"; break; case "text_color": echo "
Normal text color"; colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=text_color&hexcolor="); echo "

"; break; case "link_color": echo "
Link color"; colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=link_color&hexcolor="); echo "

"; break; case "vlink_color": echo "
Visited link color"; colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=vlink_color&hexcolor="); echo "

"; break; case "heading_color": echo "
Heading color"; colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=heading_color&hexcolor="); echo "

"; break; } echo "
Color Configuration Parameters


Select the color you'd like to change

Page background color$curbgc
Sidebar color$cursbc
Menu background color$curmbgc
Normal text color$curtc
Link color$curlc
Visited link color$curvlc
Heading color$curhc
"; break; case "misc": $curttl = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"session_ttl_days\""))[0]; if ($ostype == 'WIN') { $curssdir = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"win_server_session_dir\""))[0]; } else { $curssdir = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"unix_server_session_dir\""))[0]; } $currpartfuncs = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"parts_functions\""))[0]; $currschedmaintfuncs = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"schedmaint_functions\""))[0]; echo "
Miscellaneous Configuration Parameters


Session expiration time (users will have to log in again after this long) :   days

Server session file directory (must be writable by the web server process) :


Force logout of all users  

Enable Parts Functionality  

Enable Scheduled Maintenance Functionality  


"; if ($isadmin) { echo "     
"; } echo "

"; break; default: echo "Unknown config type!"; break; } break; default: echo "

Select one of the options above.
"; break; } banner($print); pageblock("right", "end"); pagetable("end"); framework("end", "", "", $print);