Download presentation
Presentation is loading. Please wait.
Published byPrimrose Flowers Modified over 9 years ago
1
CGI Programming
2
What is it? CGI –Common Gateway Interface Standard way to pass information back to the Web Server –GET Query String –POST Standard Input
3
What is CGI? CGI is platform independent CGI is language independent Perl is the most popular development language
4
CGI Environment CGI uses a subset of the OS environment for the application Can access native applications on server Runs as the server userid (normally) See showenv.pl
5
CGI/HTML Data is passed to a CGI program from a HTML file with the Form tag –Method = GET –Method = POST
6
Parsing Data If request is passed via GET, use QUERY_STRING environmental variable If request is passed via POST, you must read in the data from STDIN (the CONTENT_LENGTH environmental variable specifies how much data to read)
7
Parse Some Data See advance.htm See simple_parse.pl See sample_cgipm.pl
8
Form Verification Need to verify data before processing Bad data can be a security risk Assume all data is initially bad see verify.pl (In real life also use JavaScript )
9
Cookies: State Management HTTP is stateless Cookies are the standard method for state management Can use hidden fields, mangled URLs, etc see cookie.htm see cookie.pl Cookies are not evil! :)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.