Title: Remote Processing
1ITC125 The Information Superhighway
2Remote processing Objectives
- After completing the work for this week, you
should be able to - Explain what remote processing is
- Understand the function and operation of the
Common Gateway Interface (CGI) - Understand how forms are created and processed
3In previous times ..
- WWW was made of static documents
- Each URL represented a single file that did not
change over time - Today documents are created on the WWW as
required - in real time
- dynamic
4How do we retrieve dynamic information on the WWW?
- A web client (you) requests information from a
server you send this to a server. - The web server listens for such requests from
browsers and then runs a script (or small
program). - Such scripts reside in a special area on the
server these instructions tell the server what
to do typically to access a database. - The database provides the required information.
- The script obtains the information and then
creates a web page contained that information
displays it.
5Client Server Model
- Basically we have a script (program) on one
computer that has rights to access the data in a
database and provide that data to a client.
Intermediary Computer
Client Computer
Server
Issues URL requests
Database
Specialisedsoftware to process
requests
Request
Results
6Another diagram to show this
Process.html
HTTP SERVER
WWW client
Hypertext link
Internet
CGI script
Database/s
7Web Servers
- First web servers were developed for UNIX.
- They are the gateways between you and Internet
- Generally web server software is free - HTTP
servers available from CERN, NCSA. - Basically they are computer program that listens
for requests (using the HTTP protocol) from
browsers. - HTTPd (ddaemon) listens on the server for
requests from the client
8daemons
- Different daemons are located on web servers
- HTTPd HTTP daemon which waits for web browser
requests in the form of http// - Telnetd Telnet daemon waits for a user to
logon to the system using the telnet protocol - FTPd FTP daemon again software that waits for
a FTP request from a client
9What happens when a request is sent to a Web
server?
- http//csusap.csu.edu.au/jatkinso/index.html
- Request sent to csusap server
- httpd daemon locates the document index.html
- The daemon will carry out the requirements
defined in index.html and return it to the
browser - http//csusap.csu.edu.au/cgi-bin/assign.cgi?namej
ohn - Request sent to csusap server with data
- Server runs the script assign.cgi with the data
and returns the information associated with this
script
10Remote Processing - definitions
- Remote processingis based on CGI programming.
- CGIthe Common Gateway Interface is not a
programming language rather it is an agreed
standard that allows you (through your web
browser) to exchange data with computer programs
that are located on a web server. - ExampleWhen you send your personal details to a
server, the CGI ensures that it is sent and
received in an agreed format.
11Common Gateway Interface
- Common platform independent
- Gateway CGI scripts run on a server they are
basically the programs that process the data
received from a clients browser. - Interface CGI scripts can act as a communication
channel between your customers and your server.
12More on CGI .
- CGI scripts
- the most common use of CGI is to handle the
results of forms and query submissions. - It is the method by which a web server can obtain
data from (or send data to) databases, documents
and other programs, and presents that data to
viewers on the web - It is not a programming language it is a script
that communicates between Web server and you (the
client)
13So CGI is not a programming language?
- No . It is not programming language.
- Rather it is a protocol (or specification) for
running programs on a Web server to enable - a web client to request from a web server
- to run a particular program for the requesting
client. - It is a series of simple rules that programs have
to follow to allow the above to occur
(interpreted not executed).
14Security
- it is basically the equivalent of letting the
world run a program on your system. - you open a window into your local network that
the entire Internet can peer through - CGI programs must reside in a special directory
(/cgi-bin) under control of the webmaster - Hackers will attempt to get to this directory to
perhaps steal database files or change web pages
15Means to increase security
- Aim of network security is to keep strangers out
of a web site - Problem
- Web site provide the world with controlled access
to your network where CGI scripts are executed in
response to your remote requests. - Firewalls are security walls that protect part of
a computer system password protected.
16More on CGI ..
- Why use remote processing?
- ideal method for feedback
- great opportunities for marketing
- beware of the concerns .....
- What do you need?
- authority to configure the server to deal with
resulting incoming data
17What does the CGI programs do?
- There are actually three steps to a CGI script
- Checks, receives and parses the values from the
client to the CGI script. - Decodes the values and extracts them and then
acts upon them. - Prepares the output generated as a result of the
parsed values to a Web server. - The output may be a Web page, a file, an image,
audio clip or any other applicable MIME type.
18Similar diagram to before ..
form.html
HTTP SERVER
WWW client
Hypertext link
Internet
CGI program
Database/s
19Remote processing steps
Web Client
Web Server
CGI program
Database
Send URL and data
Pass data to CGI program
Store and retrieve data from database
Construct HTML page using data from input and
database
Send HTML to user
20Yet another View of the Remote Processing Process.
21CGI scripts
- PERL
- C / C
- shell script
- Visual Basic
- JAVA
- Applescript
22Time for an example ..
- Basically
- Use HTML forms to collect data from the client
- JavaScript can be used to validate the users
input. - A submit button (on a Web browser) is used to
pass the data from the client to the server. - In such cases the Web browser makes a request to
run a CGI program. - The Web server checks to make sure the CGI
program exists - If it does the CGI program is executed
- Output from the CGI program is returned to the
Web browser - The Web browser displays the output.
23Environment variables
- A keystones of CGI is a collection of data called
environment variables - These are set each time the browser sends
information to the server and is the means to
send your data to the server. - Perhaps the most important for CGI is whether the
data is sent to the server via GET or POST and
how much was sent for POST, and what the data was
for GET - Other information sent includes IP address of the
visitor, the browser being sent
24Examples of Environment Variables
- Remote_address where the form was filled in at
- Request_method defines how the data will be
sent to the server (either POST or GET) - Content_length contains the length of the data
coming from the form using the POST method. - Query_string only used with the GET method
contains the data that is being sent. Note it
will be empty for the POST method - HTTP_USER_AGENT defines the visitors platform
25What are forms
- Forms can contain a wide range of HTML markup
including (these examples are only specific to
HTML) - Single and multi-line text fields
- Radio button groups
- Checkboxes
- Menus
- Buttons (submit and reset)
- Password fields (non-display)
26HTML code to create form elements
- To create a form use
- ltformgt and lt/formgt tags
- Inside the form, use a series of INPUT fields
plus ordinary HTML this involves - via key value pairs for each input variable
- GET and POST used to pass these variables to CGI
program
27Form code
- ltform ACTIONurl methodmethod
enctypetypegt field definitions lt/FORMgt - ACTION specifies a URL which is either used to
post forms via email or used to invoke a server
side forms handler via HTTP. - METHOD - GET - appends key value pairs to
the URL - ? separates the URL proper from the
parameters which are extracted by the httpd
server and passed to the CGI program -
POST - sends the data as a separate stream - ENCTYPE - specifies the encoding to be used
28ITC125 The Information Super Highway
29ITC125 The Information Super Highway
30Examples of GET and POST
- Method examples of the format
- a. GET
- data is encoded in the URL - actual data follows
a ? - b. POST
- data pasted in the body of the request to the
server - field values are sent as values/name pairs
- field11field2threeseparatewordsfield37e
- decoding of input
31Example of a form
- Example
- ltform actionmailtojatkinson_at_csu.edu.au
methodpostgt - ltfont size1gt19lt/fontgt I would recommend
.... lt input typeradio nameq19
valueSAgtStrongly Agree ltinput typeradio
nameq19 valueAgtAgree -
- ltPgt
- lt input typeradio nameq19
valueDAgtDisagree .. - lt/formgt
32Example of a comment box
- Example
- lth3gtCommentslt/h3gtltbgtComment on two
....lt/bgtlttextarea namepos rows6
cols60gtlt/textareagt
33Example of submit / reset a form
- Exampleltinput type submit valueSubmit
questionnairegt - ltinput typereset value Clear formgt
- Submit defines a button that users can click to
submit the forms content to the server. The
button name is set. - Reset defines a button that users can click to
reset the form fields to their initial state when
the document was first loaded. Reset button data
is never sent as part of the forms contents
34Other references on forms
- Try this reference http//archive.ncsa.uiuc.edu/S
DG/Software/Mosaic/Docs/fill-out-forms/example-1.h
tmlThere are 13 examples of basic forms - a
fantastic reference to copy material into your
new forms.
35- action"mailtojsmit01_at_life.csu.edu.au" method
"POST" - Your Name ltinput name"ReaderName size 15gt
- Did you like my Homepage?ltBRgt
- ltinput typeradio" name"Page" value"Yes"gt Yes
lt /brgt - lt input type radio" name "Page" value "No"gtNo
- ltpgt lt input type checkbox" name"Flag"
value"Like"gt lt/pgt - Check the box if you think I did alright. ltPgt
- How Good did I do?
- ltselect name"PageJob"gt
- ltoptiongtExcellent ltoptiongtVery Good
ltoptiongtGood - ltoptiongtKeep Trying lt/selectgt
- ltPgt ltinput type"SUBMIT" value"Send your vote"gt
lt/formgt
36Outputs from CGI programs
- referred to as dynamic documents these are
documents that are created on-the-fly by a CGI
program. This can be done by - hard coding in the CGI program via a number of
print statements or equivalent - HTML template files residing on the server that
substitute in the variables and writing it to
STDOUT - static HTML files read by the CGI program and
written directly to STDOUT with no processing - CGI specifications define how HTTP servers
interact with external gateways
37JAVA script
- JAVA script basically a means to customise your
web pages and process information - Example of a very simple java script program
- ltscriptgt document.bgcolorgreenlt/scriptgt
- or
- ltscriptgt window.status"Welcome to my
homepage"lt/scriptgt
38More little examples for your to try
- ltscriptgt alert("Welcome, my
friend!")lt/scriptgt - ltscriptgt var answerconfirm("Jump to CSU?")
if (answer) window.location"http//www.csu.
edu.au" lt/scriptgt - ltscriptgt var answerprompt("Please enter your
name") alert("Hello "answer)lt/scriptgt
39Electronic Commerce
- Electronic commerce (E-commerce) online selling
- E-Commerce differs from the traditional shop
front for example - Traditional Store E-Commerce store
- Physical space Web Space
- Aisles and shelves Searchable databases
- Cash register Electronic payment only
- Shopping trolleys Virtual shopping trolleys
- Cash-and-carry Shipped deliveries only
- Personalised service Impersonalised service
40Electronic Commerce
- Building your own E-Commerce site how can you
do it? - Off-the-shelf software
- Domain names
- Order processing how can they be received
- Payment details method and security
- Look and layout
- Security secure socket layer (SSL)