CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to the Common Gateway Interface (CGI) Instructor: Joseph DiVerdi,

Slides:



Advertisements
Similar presentations
1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 1 Introduction to Perl and CGI.
Advertisements

Web forms and CGI scripts Dr. Andrew C.R. Martin
Lecture 11 Server Side Interaction
Adding Dynamic Content to your Web Site
DT211/3 Internet Application Development Active Server Pages & IIS Web server.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
CGI and Perl MSc Publishing on the WWW. What is CGI ? (1) User Buying and selling Playing games Customised web pages Developer Means to run external programs.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Chapter 6: Hostile Code Guide to Computer Network Security.
CGI Programming Languages Web Based Software Development July 21, 2005 Song, JaeHa.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
INTRODUCTION TO WEB DATABASE PROGRAMMING
NETWORK CENTRIC COMPUTING (With included EMBEDDED SYSTEMS)
Webmaster Overview Fort Collins, CO Copyright © XTR Systems, LLC Webmaster Overview Instructor: Joseph DiVerdi, Ph.D., MBA.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Chapter 8 The Internet: A Resource for All of Us.
1 In the good old days... Years ago… the WWW was made up of (mostly) static documents. –Each URL corresponded to a single file stored on some hard disk.
CSU - DCE Internet Security... Privacy Overview - Fort Collins, CO Copyright © XTR Systems, LLC Setting Up & Using a Site Security Policy Instructor:
CSU - DCE Advanced Perl CGI Operation - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to the Common Gateway Interface (CGI) on the.
Java CGI Lecture notes by Theodoros Anagnostopoulos.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 7: HTTP and CGI Fundamentals of Web Programming.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
CSU - DCE Webmaster I HTML - Forms - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites using HTML - Introduction to Forms Instructor:
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
1 Basic Perl CGI Programming. 2 Issues How and when your program is invoked. Generating Response –HTTP Headers –HTML (or whatever document type you want)
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
CSU - DCE Advanced Perl First Web Page - Fort Collins, CO Copyright © XTR Systems, LLC Creating Your First Web Page Instructor: Joseph DiVerdi,
Overview Web Session 3 Matakuliah: Web Database Tahun: 2008.
A Little Bit About Cookies Fort Collins, CO Copyright © XTR Systems, LLC A Little Bit About Cookies Instructor: Joseph DiVerdi, Ph.D., M.B.A.
Introduction to CGI/Perl Please use speaker notes for additional information!
CSU - DCE Webmaster I Design with HTML #1 - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites using HTML #1 Instructor: Joseph DiVerdi,
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
Intermediate CGI & CGI.pm Webmaster II - Fort Collins, CO Copyright © XTR Systems, LLC CGI Programming & The CGI.pm Perl Module Instructor: Joseph DiVerdi,
Introduction & Overview Introduction to PHP - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to & Overview of PHP Instructor: Joseph DiVerdi,
CSU - DCE Webmaster I HTML - Tables - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites using HTML - Introduction to Tables Instructor:
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
Creating a Remotely-Hosted Web Site Fort Collins, CO Copyright © XTR Systems, LLC Creating Your First Remotely-Hosted Web Site Instructor: Joseph DiVerdi,
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
Fall 2000C.Watters1 World Wide Web and E-Commerce Servers & Server Side Processing.
Introduction to JavaScript Fort Collins, CO Copyright © XTR Systems, LLC Introduction to JavaScript Programming Instructor: Joseph DiVerdi, Ph.D., MBA.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
Webmaster II Introductions - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to Webmaster II Instructor: Joseph DiVerdi, Ph.D., MBA.
How CGI and Java Servlets are Run By David Stein 14 November 2006.
CS 330 Class 8 Homework A pattern that contains a word with an optional period A pattern that contains Fred with a space (not Freddy) See regexp.txt guest4.htm.
CSU - DCE Introduction to CSS CSS URLs - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Specifying URLs Instructor: Joseph.
Introduction to CGI PROG. CGI stands for Common Gateway Interface. CGI is a standard programming interface to Web servers that gives us a way to make.
CSU - DCE Advanced Perl Introductions - Fort Collins, CO Copyright © XTR Systems, LLC Advanced Perl Programming Instructor: Joseph DiVerdi, Ph.D.
Introduction to Server Side Includes Fort Collins, CO Copyright © XTR Systems, LLC Introduction to Server Side Includes (SSI) Instructor: Joseph DiVerdi,
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
PHP Introduction & Overview Fort Collins, CO Copyright © XTR Systems, LLC Introduction to & Overview of PHP Instructor: Joseph DiVerdi, Ph.D., MBA.
CSU - DCE Webmaster JavaScript Class - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to Object-Oriented Perl and CGI.pm Instructor:
Lesson 11. CGI CGI is the interface between a Web page or browser and a Web server that is running a certain program/script. The CGI (Common Gateway Interface)
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
CSU - DCE Webmaster I HTML & URLs - Fort Collins, CO Copyright © XTR Systems, LLC Designing Web Sites With HTML - Using Effective Links Instructor:
The Common Gateway Interface (CGI) Pat Morin COMP2405.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Distributed Control and Measurement via the Internet
CS 330 Class 7 Comments on Exam Programming plan for today:
Introduction to Programming the WWW I
Introduction to Servlets
Web Application Development Using PHP
Presentation transcript:

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Introduction to the Common Gateway Interface (CGI) Instructor: Joseph DiVerdi, Ph.D., M.B.A.

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Examples Web Clock Changes from one viewing to another

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Examples Simple Survey

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Examples Simple Game

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Examples Quiz

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Examples Search Engine

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Examples Database access

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Overview CGI stands for Common Gateway Interface –It is a Specification Which Permits The Web Server Program to Communicate With Other Programs That Are Running On The Server Web Server Only Knows How to Serve Up HTML Pages CGI Enables Server to Interact With Other Programs

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Overview Operation is as follows: –Client Requests a Document –Server Recognizes That Document is a Program –Server Executes Program Supplies Data to Program Obtained From Client Request –Server Receives Program Output –Server Returns Document to Browser –Client Renders Document

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Dynamic Image Inclusion Digital Clock Demo

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Examples Web Clock Changes from one viewing to another

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Overview There are Few Restrictions on What Programming Language is Used in CGI Programs Perl, Java, Visual Basic, AppleScript, Shell, C++,... Perl is the Most Popular Language In Use CGI Defines The interface Between The Web Server & The Program –In Both Directions Web Server --> Program Program --> Web Server

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI In Brief

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Uses of CGI Page Serving is Not Limited To Previously Written Documents Web Pages Can Created On-The-Fly –Can Be Based on The Viewer's Input Collect Viewer Comments Respond to Responses

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Dynamic Page Content Page Created Dynamically Via CGI Program Page With Server Side Includes (SSI) Page With Embedded Call to CGI Program –The Result is Still an HTML Page –Viewer's Browser Just Sees HTML –CGI Interaction is Behind The Scenes

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Database Interaction Web Interface to Relational Database Management System (RDBMS) CGI Program is Required to –Decode Viewer Input –Assemble Query –Send Query to Database –Process Data Returned From Database –Create Return HTML Document

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Gateway to a Database

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Setting Up For CGI Programs Create cgi directory in html directory –CaSe iS vErY iMpOrTaNt! Ensure cgi directory has 755 permission Programs must be placed in this directory –Server is configured only to execute from there Programs placed in and viewed from other directories will not execute and the program contents will be rendered on the browser

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Using CGI Programs Ensure CGI programs have 755 permission Always test program with telnet client FIRST! –Login to your account –Navigate to the html/cgi directory –Check if the program executes successfully env.cgi Then test using Browser

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Simple Shell Program Create a file "env.cgi" #! /bin/sh echo "Content-type: text/html" echo env Remember... –CGI programs can be written in many languages

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Simple But Useful Program Create a file "simple.pl" #! /usr/bin/perl -w print "Content-type: text/html\n\n"; print "Hello, CGI Programmer! "; exit; Save file in cgi directory Ensure program has 755 permission Test using telnet client Test using browser

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC More Useful Program Modify the file "simple.pl" #! /usr/bin/perl -w print "Content-type: text/html\n\n"; print "Hello, CGI Programmer! "; print "The current time is ", scalar localtime, " "; print "You are using the computer: ", $ENV{'REMOTE_HOST'}, " "; exit;

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Form Processing Client Requests a Form

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Form Processing Client Renders Form

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Form Processing Viewer Fills in Form Client Sends Form to Server

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Form Processing Client Sends Data to Server –Uses POST Method in HTTP Request POST /cgi/formmail.pl HTTP/1.0 Host: xtrsystems.com... more headers here... ice_cream_flavor=chocolate

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Form Processing Server Recognizes URL –URL Points to CGI Program It knows because of the directory in the URL /cgi/formmail.pl Server Executes Program –Supplies Form Data to Program Form Data Received From POST Request "ice_cream_flavor=chocolate"

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI In Brief

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Form Processing Program Performs Some Work –Some Combination of the Following Stores Submitted Data in Database Creates Message From Submitted Data –Always Does This Creates HTML Thank You Page Sends Program Output to Server –HTML Thank You Page is Program Output

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI Form Processing Server Sends HTML Document to Browser Client Renders HTML

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC CGI and Form Processing

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Executing CGI Programs CGI Programs Are Just Like Other Resources –Can Reside on Your Host The Host With the Server –Can Reside on Some Other Host With the Owner's Agreement Without the Owner's Agreement Unlike Other Resources –Must Reside in Specific Directories on Each Host Directory Selected by Webmaster or Site Administrator –Much Harder to Write than HTML Documents

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Hands On Work Create an Ice Cream Survey Form Page –Include the following HTML: You are using the formmail program –Executing On the xtrsystems.com Server Host

CSU - DEO Introduction to CGI - Fort Collins, CO Copyright © XTR Systems, LLC Using Your own Programs Install formmail.pl in Your Own Account –Download From Course Materials Page –Upload to cgi Directory –Check Program Permission –Modify Form HTML –Test as Described Earlier –Modify Program Be Very Careful –Have Fun