/
menuBar.cgi-pl
executable file
·50 lines (36 loc) · 2.08 KB
/
menuBar.cgi-pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/perl
use LAM::LAM qw(displaySource htmlHead menuBar
emailAddress); # Lexicon Abstact Map
use LAM::Multicount qw(webPageCounter);
use CGI qw(:all); # CGI - Load standard functions.
use strict; # Force me to use strict variable syntax.
use warnings; # Enable all warnings.
LAM::displaySource( # Display source, rlog, etc. if requested.
"https://github.com/LAMurakami/no-ssl/blob/master/html/Public/Scripts/menuBar.cgi-pl");
my $programDescription = <<ENDprogramDescription
<br><br><p> I originally created the menuBar.cgi-pl program to test the display
of the appropriate menuBar on my site. The program was modified to make the
program a wrapper for html pages on my site. This program adds the menuBar
and style to the pages much like the MySQLhtml.cgi-pl and previous wrapper
programs I have written. Which pages it is applied to will be controlled
by RewiteRule directives and the Apache server configuration.
<br><br><p> This text is displayed when the program is accessed with a URL
that does not point to an appropriate html file.
<br><br>
ENDprogramDescription
;
REWRITE:{
if ($ENV{RewriteHtml}) {my $rewriteHtml = $ENV{RewriteHtml};
if ($rewriteHtml =~ /^\/menuBar.html/) {last REWRITE};
my $fileName = "$ENV{DOCUMENT_ROOT}$rewriteHtml";
my $text = LAM::getTextFile($fileName);
my $title = 'LAM Alaska menuBar';
if ($text =~ /<title\s*>(.+)<\/title\s*>/is) {$title = $1}
print LAM::htmlHead('-i', 'LAM', $title), "\n", LAM::menuBar, "\n", $text
, hr() ,Multicount::webPageCounter('-u'), br()
, "\n", "Uptime: ", qx(uptime), "\n<br>"
, "\n$ENV{REMOTE_ADDR} $ENV{REQUEST_METHOD} from server \n"
, a({-href=>"/",-name=>"tail"} , $ENV{SERVER_NAME}) , LAM::emailAddress();
exit(0) # Halt any further execution of program.
}} LAM::displayPage('-t', 'LAM Alaska menuBar', # Display program description
'LAM Alaska menuBar', '', $programDescription); # when no query string