fundamentals of cgi programming using perl
DESCRIPTION
Fundamentals of CGI Programming Using Perl. Lesson 1: Application Development Fundamentals. Objectives. Explain the application development process Distinguish among various application development environments Identify common application development platforms - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/1.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Fundamentals of CGI Programming Using Perl
![Page 2: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/2.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 1:Application
Development Fundamentals
![Page 3: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/3.jpg)
Objectives
• Explain the application development process• Distinguish among various application
development environments• Identify common application development
platforms• Clarify various communication protocols• Determine when to use client-side or server-
side scripting
![Page 4: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/4.jpg)
The ApplicationDevelopment Process
• Define a need for a solution
• Analyze the requirements
• Create an implementation plan and perform top-level design
• Perform in-depth design
• Create the application
• Test the system• Deploy the system• Maintain the system
![Page 5: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/5.jpg)
Platforms,Languages and Protocols
• Development platforms• Server-side development technologies• Client-side development technologies• Communication protocols
![Page 6: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/6.jpg)
Client-Side vs. Server-Side Scripting
• Performance issues• Security risks
![Page 7: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/7.jpg)
HypertextTransfer Protocol
• Passing information with HTTP• HTTP methods
![Page 8: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/8.jpg)
Summary
Explain the application development process Distinguish among various application
development environments Identify common application development
platforms Clarify various communication protocols Determine when to use client-side or server-
side scripting
![Page 9: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/9.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 2:Introduction to
CGI and Perl
![Page 10: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/10.jpg)
Objectives
• Explain how the Common Gateway Interface works
• Describe the GET and POST methods• Describe the benefits of CGI• Describe the benefits of choosing Perl as your
CGI scripting language
![Page 11: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/11.jpg)
Web Architecture Overview
• Browser, server and script interaction• Common Gateway Interface
![Page 12: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/12.jpg)
What Is CGI?
• Common– Supported on almost every platform
• Gateway– Gate or conduit that connects clients and
servers or server programs• Interface
– The manner in which the gateway is used
![Page 13: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/13.jpg)
Why Use CGI?
• Two-directional communication• Storage of user-entered data• Portability of code• Browser independence
![Page 14: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/14.jpg)
What Is Perl?
• Practical Extraction Report Language
![Page 15: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/15.jpg)
Why Use Perl?
• Free license• Smooth installation• Pre-existing programs• Text and file processing capabilities• Strong points from other languages
![Page 16: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/16.jpg)
Summary
Explain how the Common Gateway Interface works
Describe the GET and POST methods Describe the benefits of CGI Describe the benefits of choosing Perl as your
CGI scripting language
![Page 17: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/17.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 3:Creating a
Simple Script
![Page 18: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/18.jpg)
Objectives
• Discuss the advantages and disadvantages of client-side and server-side scripts
• Use scalar variables• Print HTML to the browser using the print
statement
![Page 19: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/19.jpg)
Key Concepts and Syntax
• Client-side versus server-side scripting• Scalar variables in Perl• Built-in functions• Single and double quotation marks• Using variables in strings• User-defined functions
![Page 20: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/20.jpg)
Key Concepts and Syntax (cont’d)
• Printing HTML from a Perl script• Including HTML after the _END_ keyword• Printing HTML using print <<ANYWORD• Printing HTML from a file
![Page 21: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/21.jpg)
Summary
Discuss the advantages and disadvantages of client-side and server-side scripts
Use scalar variables Print HTML to the browser using the print
statement
![Page 22: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/22.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 4:Perl Fundamentals
![Page 23: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/23.jpg)
Objectives
• Use CGI.pm to examine environment variables• Use Perl arrays and associative arrays• Define list and scalar context• Use pattern matching operators• Write if statements• Create loops
![Page 24: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/24.jpg)
Accessing Environment Variables
• Environment variables are stored in an associative array
![Page 25: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/25.jpg)
Using CGI.pm to Access Environment Variables
• Simpler CGI.pm syntax• Environment access methods
![Page 26: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/26.jpg)
If Statement
• Used exactly as it is used in JavaScript• Can also be used in a unique way at the end of
any statement
![Page 27: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/27.jpg)
Logical Expressions
• Numeric and string operators
![Page 28: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/28.jpg)
Pattern Matching
• Pattern matching operator
![Page 29: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/29.jpg)
Perl Arrays
• Holds a list of scalars (numbers of strings)• List context versus scalar context
– Initializing scalar variables from an array
![Page 30: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/30.jpg)
Passing Values to Functions
• Values that are passed to functions are held in arrays
![Page 31: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/31.jpg)
Associative Arrays
• Converting associative arrays to arrays• Using join with arrays and associative arrays• Using split with arrays
![Page 32: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/32.jpg)
Loops
• The while loop• The next and last statements• The for loop• The foreach loop• The sort function
![Page 33: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/33.jpg)
Summary
Use CGI.pm to examine environment variables Use Perl arrays and associative arrays Define list and scalar context Use pattern matching operators Write if statements Create loops
![Page 34: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/34.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 5:Perl File Input and Output Capabilities
![Page 35: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/35.jpg)
Objectives
• Open and close files from within scripts• Read and write to sequential files• Read and write to random-access files• Define file modes• Use the diamond operator in scalar and list
contexts• Use file tests in conditional statements
![Page 36: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/36.jpg)
File IO Using File Handles
• The unless statement• The die statement and the | | operator• The && operator
![Page 37: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/37.jpg)
File Modes
• Reading a file• Writing to a file• Appending to a file• Reading and writing to a random-access file
![Page 38: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/38.jpg)
Using Files in Scripts
• Writing to a file• Reading from a file using the diamond
operator <>• Reading from a file using the read function• Reading and writing to a random-access file• The seek function
![Page 39: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/39.jpg)
Creating a Hit Counter
• Every time a page is called, a counter reads and increments the number in the file, and stores it back to the file
![Page 40: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/40.jpg)
Summary
Open and close files from within scripts Read and write to sequential files Read and write to random-access files Define file modes Use the diamond operator in scalar and list
contexts Use file tests in conditional statements
![Page 41: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/41.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 6:Controlling
Processing and Output
![Page 42: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/42.jpg)
Objectives
• Use the HTML form generation methods of CGI.pm to create HTML pages
• Use the param method to retrieve form values• Create a dual-mode form that accepts and
generates data depending on how it is accessed
• Validate form data and print a missing fields page
• Test Perl scripts in offline mode
![Page 43: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/43.jpg)
Incorporating HTML into Perl Using CGI.pm
• Methods of CGI.pm include– start_html– end_html– startform A,B,C– endform– submit A– textfield A,B,C,D– button A,B– hidden A,B– header A
![Page 44: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/44.jpg)
Using CGI.pm to Access Form Data
• The POST method• Using CGI.pm for GET or POST
![Page 45: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/45.jpg)
ProcessingUser-Entered Data
• Using the ReadParse method
![Page 46: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/46.jpg)
Using One File to Createand Process an HTML Form
• Perl scripts can operate in two modes– Called from a hyperlink– Called from a form submission
![Page 47: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/47.jpg)
Using Perl toValidate Form Input
• Perl scripts commonly validate form data:– Before saving the data– Before processing the data
![Page 48: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/48.jpg)
Summary
Use the HTML form generation methods of CGI.pm to create HTML pages
Use the param method to retrieve form values Create a dual-mode form that accepts and
generates data depending on how it is accessed
Validate form data and print a missing fields page
Test Perl scripts in offline mode
![Page 49: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/49.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 7:Saving
User-Supplied Data to a File
![Page 50: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/50.jpg)
Objectives
• Use the named parameters syntax for CGI.pm methods
• Save data to a file in a tab-delimited format• Save data to a file using the save method of
the CGI.pm module• Delete and append name-value pairs• Use the substitution pattern-matching
operator• Use the &_ variable to simplify scripts
![Page 51: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/51.jpg)
Saving Form Data to a File
• To save form data:– Access the field data using the param
method– Write (print) the field data to an open file
![Page 52: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/52.jpg)
Modifying Form Data
• Named parameters syntax• Methods of CGI.pm with named
parameters• The delete method• The append method
![Page 53: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/53.jpg)
Pattern Matching Revisited
• Pattern-matching operator revisited• Substitution operator
![Page 54: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/54.jpg)
Summary
Use the named parameters syntax for CGI.pm methods
Save data to a file in a tab-delimited format Save data to a file using the save method of
the CGI.pm module Delete and append name-value pairs Use the substitution pattern-matching
operator Use the &_ variable to simplify scripts
![Page 55: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/55.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 8:Reading a File
![Page 56: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/56.jpg)
Objectives
• Use regular expressions to match patterns• Substitute characters from a string using
regular expressions
![Page 57: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/57.jpg)
Pattern Matching withRegular Expressions
• Special characters• Quantifiers• Memory
![Page 58: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/58.jpg)
Substitution
• Contains four parts– The character s– The pattern match– The replaced characters– The character g
![Page 59: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/59.jpg)
Summary
Use regular expressions to match patterns Substitute characters from a string using
regular expressions
![Page 60: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/60.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 9:Introduction to Databases
![Page 61: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/61.jpg)
Objectives
• Explain the need for databases• Use the DBI interface to access a database
using any DBD driver• Describe a four-step process for writing
database programs• Use the connect method to access a database
![Page 62: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/62.jpg)
Objectives (cont’d)
• Write simple and complex SQL statements• Use the q{} and qq{} quoting operators to
write simple SQL statements• Query the table names and table field names
of a database• Combine the CGI and DBI Perl modules to
create a Perl script that accesses and formats data for presentation in the browser
![Page 63: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/63.jpg)
Introduction toDatabase Programming
• Benefits of database interaction• Database Interface (DBI) module• Database Driver (DBD) module
![Page 64: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/64.jpg)
Four Steps to Interacting with Databases
• Connect to the database• Query the database• Display the results• Close the connection
![Page 65: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/65.jpg)
Connecting to Databases
• The connect method• SQL SELECT statement
![Page 66: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/66.jpg)
Quoting Revisited
• q{}• qw{}• qq{}
![Page 67: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/67.jpg)
Querying Table and Field Names
• If the query selects all the fields of a table, you can retrieve a list of all the field names
![Page 68: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/68.jpg)
Summary
Explain the need for databases Use the DBI interface to access a database
using any DBD driver Describe a four-step process for writing
database programs Use the connect method to access a database
![Page 69: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/69.jpg)
Summary (cont’d)
Write simple and complex SQL statements Use the q{} and qq{} quoting operators to
write simple SQL statements Query the table names and table field names
of a database Combine the CGI and DBI Perl modules to
create a Perl script that accesses and formats data for presentation in the browser
![Page 70: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/70.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 10:Deleting and
Inserting Database Records
![Page 71: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/71.jpg)
Objectives
• Use the do method to quickly execute SQL statements
• Use the DELETE command to delete records from a database
• Use the INSERT command to insert records in a database
• Use the UPDATE command to modify records in a database
![Page 72: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/72.jpg)
Modifying Data in a Database
• DELETE command• INSERT command• UPDATE command
![Page 73: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/73.jpg)
The do Method
• Duplicates the function of the prepare and execute methods
![Page 74: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/74.jpg)
Summary
Use the do method to quickly execute SQL statements
Use the DELETE command to delete records from a database
Use the INSERT command to insert records in a database
Use the UPDATE command to modify records in a database
![Page 75: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/75.jpg)
Copyright © 2003 ProsoftTraining. All rights reserved.
Lesson 11:CGI Security Issues
![Page 76: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/76.jpg)
Objectives
• Describe how hackers gather information about your system
• Prevent unauthorized reading of CGI scripts or data saved by CGI scripts
• Use CGI wrappers to separate multiple users on the same server
• Discuss security issues introduced by Web server extensions
• Use four techniques to prevent shell expansion of data passed to launched programs
![Page 77: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/77.jpg)
Type of Attacks
• Hackers can gather information about your system by– Exploiting bugs in server application
software– Accessing demo CGI scripts– Reading contents of poorly configured CGI
scripts– Readings contents of data saved
improperly– Passing data to your CGI scripts to launch
unexpected commands
![Page 78: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/78.jpg)
Securing the CGI Script
• Reading CGI scripts• Writing CGI script data• Web server user ID• CGI wrappers
![Page 79: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/79.jpg)
Securing the Server
• FrontPage Extensions• ColdFusion• Active Server Pages• Web server and operating system bugs
![Page 80: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/80.jpg)
Securing Form Data
• Data as a file name• Maintaining state with hidden fields• Maintaining state with cookies• Cookies versus hidden fields
![Page 81: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/81.jpg)
Securing DataPassed to Commands
• The eval method• The exec method• The system method
![Page 82: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/82.jpg)
Summary
Describe how hackers gather information about your system
Prevent unauthorized reading of CGI scripts or data saved by CGI scripts
Use CGI wrappers to separate multiple users on the same server
Discuss security issues introduced by Web server extensions
Use four techniques to prevent shell expansion of data passed to launched programs
![Page 83: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/83.jpg)
Fundamentals of CGI Programming Using Perl
Application Development Fundamentals Introduction to CGI and Perl Creating a Simple Script Perl Fundamentals Perl File Input and Output Capabilities Controlling Processing and Output Saving User-Supplied Data to a File
![Page 84: Fundamentals of CGI Programming Using Perl](https://reader030.vdocument.in/reader030/viewer/2022033022/568131a8550346895d981770/html5/thumbnails/84.jpg)
Fundamentals of CGI Programming Using Perl
Reading a File Introduction to Databases Deleting and Inserting Database Records CGI Security Issues