#!/usr/bin/perl use CGI; use BOHTTPD; my $cgi = new CGI; sub show_applet { my $path = $cgi->param('path') || (is_ms ? '/c:/Program Files' : '/usr/local'); $path =~ s/^\/+//; $path =~ s/\/+$//; my $host = $ENV{REMOTE_HOST} || $ENV{REMOTE_ADDR}; my $port = $cgi->param('port') || 8080; my $url ="http://${host}:${port}/${path}/"; my ($HOST, $PATH, $PORT, $URL) = map html_escape($_), $host, $path, $port, $url; if (is_ie) { print qq<
BOHTTPD does not yet work with Internet Explorer. Get the latest version of Netscape Communicator in order to convert your browser into a Web Server!
> } else { print qq<You are now running BOHTTPD on port $port!
Click the link below to access your browser's web server:
> } } sub show_form { my $path = $cgi->param('path') || (is_ms ? '/C:/Program Files/' : '/usr/local/'); $path =~ s/^\/\/+/\//; $path =~ s/\/\/+$/\//; my $port = $cgi->param('port') || 8080; my ($PATH, $PORT) = map html_escape($_), $path, $port; show_info; print qq< > } sub show { show_header; if ($cgi->param('do') eq 'applet') { show_applet; } else { show_form; } show_footer; } print "Content-type: text/html\n\n"; &show; 1