CGI samples - Fog.ccsf.edu

Download Report

Transcript CGI samples - Fog.ccsf.edu

CNIT 133 Interactive Web Pags –
JavaScript and AJAX
CGI Samples
Agenda
• My Web Site: http://fog.ccsf.edu/~hyip
(download syllabus, class notes).
• Perl
• Unix Shell Script
• PHP
PERL
<form method="post" action="/cgi-bin/cgiwrap/USERID/cgi-bin/perlform.pl">
• Note: USERID is your hills userid and perlform.pl is
the name of your cgi-script. CGIWrap is a gateway
program that allows general users to use CGI scripts
and HTML forms without compromising the security
of the http server. Scripts are run with the
permissions of the user who owns the script. In
addition, several security checks are performed on
the script, which will not be executed if any checks
fail. CGIWrap is used via a URL in an HTML
document. As distributed, cgiwrap is configured to
run user scripts which are located in the
~/public_html/cgi-bin/ directory.
Unix Shell Scripting
<form method="get" action="/cgi-bin/cgiwrap/USERID/cgi-bin/unixform.ksh">
• Note: USERID is your hills userid and unixform.ksh is
the name of your cgi-script. CGIWrap is a gateway
program that allows general users to use CGI scripts
and HTML forms without compromising the security
of the http server. Scripts are run with the
permissions of the user who owns the script. In
addition, several security checks are performed on
the script, which will not be executed if any checks
fail. CGIWrap is used via a URL in an HTML
document. As distributed, cgiwrap is configured to
run user scripts which are located in the
~/public_html/cgi-bin/ directory.
PHP
<form method="post" action="../../php/phpform.php">
• You must create a php directory within public_html
on the hills server and give this php directory a unix
permission of 711.
• Then, put all the php scripts inside this php directory.
• Execute your php script as if it was located in your
web server home directory (public_html).