|
Article 5 - CGI Form Handling with Perl
|
|
Installation:
|
|
Part I: The Message Manager Transaction
|
-
create an Admin subdirectory of
/cgi-bin/thecgibin/testart05/
-
it'd be a good idea to set up .htaccess password
protection for the Admin subdirectory so hackers can't
get into your site and run this program
-
ftp msg_mgr.cgi to your /cgi-bin/thecgibin/testart05/
directory
-
create error_fld.pl from the code below and ftp it to the
testart05 directory
# all the NCSA defined ErrorDocument values
%Error = (
'REDIRECT' => 302,
'BAD_REQUEST' => 400,
'AUTH_REQUIRED' => 401,
'FORBIDDEN' => 403,
'NOT_FOUND' => 404,
'SERVER_ERROR' => 500,
'NOT_IMPLEMENTED' => 501,
);
%Fldlen = (
'Brief_Description' => 75,
'Detailed_Description' => 500,
'Entrance_URL' => 50
);
1;
|
-
on telnet change directories to
cgi-bin/thecgibin/testart05/Admin and
enter the command 'perl -wc msg_mgr.cgi'.
-
you should get the response 'msg_mgr.cgi syntax ok'
-
now that the program's on your server and compiles cleanly,
you need to run msg_mgr.cgi from your browser.
-
first set the chmod to 755
-
now get on your browser and point to the cgi program as
your url... you'll get a form displaying on your screen
with the following:
- Error Document Types (checkboxes)
- select which error types you are supplying messages for
with this running of the transaction
- Brief Description
- This is the short message that will be rendered to a
visitor after the server error has occurred
- Detailed Description
- This is the longer, more detailed message that will be
rendered after the server error has occurred
- Entrance URL
- This will be presented as a link for the visitor to
click over to on the page
- Environment Variables (checkboxes)
- You may choose to show the visitor the values of any
or none of these environment variables
-
after running the transaction you should check that the
appropriate data files were created on the directory
-
next ftp handler.cgi to cgi-bin/thecgibin/testart05/ and
set the permissions to 755
-
the .htaccess file was already installed, so now you should
be able to 'run' handler.cgi --- all you gotta do is make
an error occur on your server
-
the easiest one to cause is the 404 - Page Not Found error,
and you can cause this by simply entering a non-existent
URL on the testart05 directory
-
remember that handler.cgi is only being invoked when one
of the errors occurs on the directory in which the .htaccess
file was installed, i.e. cgi-bin/thecgibin/testart05/
|
|
|