to illustrate display.pl:
1 #!/usr/bin/perl
2
3 require "../accmgr";
4
5 use Sys::Hostname;
6 use File::Basename;
7 use File::stat;
8 use Time::localtime;
9 use CGI;
10 use CGI::Carp qw(fatalsToBrowser);
11
12 print "Content-type: text/html\n\n";
13 print "<html><title>Form Upload</title><body>\n";
14
15
16 $file = "/mkapp/webapps/mxrt/html/upload_repo.html";
17
18 open(IN, "$file");
19 @lines = <IN>;
20 close(IN);
21
22 print @lines;
23
24 # need to get accmgr to pass the userid's desk back to this file
25 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';
26 print $desk;
27
28 ############ use $desk to dynamically generate the set of radio
buttons
29 # loop thru $file
30 # if <IN> = <input type="radio" name="desk"
value="BO"> BO
31 # compare value to (e.g. $desk ?= BO )
32 # if not match, skip this line
33 # if match, print this line
34
35 print "</body></html>";
accmgr:
#!/usr/bin/perl
# accmgr
#
# The script manages the access (login/passwords/ACL) to define which
users
# have access to what functionality. In addition, it supports self
# registration and password changes.
require "./mxrt_vars.pl";
require "./mxrt_auth.pl";
require "/mkapp/webapps/mxrt-cgi/dbConn.pl";
use File::stat;
use File::Basename;
use Time::Local;
#use Time::localtime;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $query = new CGI;
@GROUPS = qw(BO FO LFO SYS);
sub loadUserCfg {
$USERCFG_MTIME = stat($MXUSERCFGFILE)->mtime;
open(USERCFGFILE, "<$MXUSERCFGFILE") or
return "Unable to access User config file:".$MXUSERCFGFILE."<br>
Please try again later.";
%USERS = ();
undef @USER_DETAIL_KEYS;
undef @USER_DETAIL_VALS;
while (<USERCFGFILE>) {
chomp; # no newline
s/#.*//; # no comments
s/^\s+//; # no leading white
s/\s+$//; # no trailing white
next unless length; # anything left?
my ($var, $value) = split(/\s*=\s*/, $_, 2);
if ($var eq "UserID") {
# this is the header definitions
@USER_DETAIL_KEYS = split(':', $value);
#print "@USER_DETAIL_KEYS"."<br>";
}
else {
@USER_DETAIL_VALS = split(':', $value);
#print "@USER_DETAIL_VALS"."<br>";
my $count=0;
foreach $key (@USER_DETAIL_KEYS) {
$USERS{$var}{$key} = $USER_DETAIL_VALS[$count++];
}
}
}
close USERCFGFILE;
#foreach $user (keys %USERS) {
# foreach $key (@USER_DETAIL_KEYS) {
# print $user, $key, $USERS{$user}{$key}, "<br>";
# }
#}
return "";
}
# get the desk from user.cfg and return this desk to display.pl to
show/hide radio buttons
sub getDesk{
return $USERS{$Group}; # $Group is one of {BO FO LFO SYS}
}
How is that related to what's in display.pl?
in display.pl, i am calling accmgr with the action of "getDesk", which
runs the elsif on line 71.
accmgr:
Once again... how is that related?
line 72 of accmgr calls getDesk of accmgr (line 554-556), then returns the
value to line 61 of display.pl.
but in line 62 of display.pl, nothing gets printed.
WHY?