CGI programming Peter Verhás January 2002. What this tutorial is about Introduction to CGI programming Using ScriptBasic –Simple to program –Simple to.

Slides:



Advertisements
Similar presentations
CGI Scripting and Vulnerabilities COEN 351: E-commerce Security  Thomas Schwarz, S.J
Advertisements

Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
How does the server format the information it gives to the appln program? As environment variables and in standard input.
Configuring Apache Server and Perl for CGI T.A. Maisa Khudair Dr. Qusai Abu Ein.
CGI. XML2 Common Gateway Interface n Georgia Tech 1995 Web Usage Survey –Perl % –C % –Shell Scripts - 8.1% –Tcl - Tool Commercial Language.
Pass data1 Passing data from an HTML page to a program Dr Jim Briggs.
CGI & Perl Programming Language What is CGI? Introduction of Perl Programming Language –Simple Peal program –Perl variables –Perl Operators –Flow Controls.
Lecture 9, : The Internet, Summer : The Internet Lecture 9: Web Services II David O’Hallaron School of Computer Science and Department.
CS 898N – Advanced World Wide Web Technologies Lecture 6: PERL and CGI Chin-Chih Chang
Dynamic content 1WUCM1. 2 Basic architecture of the web.
Outcomes Know what are CGI Environment Variables Know how to use environment variables How to process A simple Query Form Able to use URL Encoding rules.
CGI. CGI Programming What is "CGI"? –Common Gateway Interface A means of running an executable program via the Web. CGI is not a Perl-specific concept.
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.
1 Web Servers Web Protocols and Practice Chapter 4.
CGI Programming Languages Web Based Software Development July 21, 2005 Song, JaeHa.
Common Gateway Interface
1 ‘Dynamic’ Web Pages So far, we have developed ‘static’ web-pages, e.g., cv.html, repair.html and order.html. There is often a requirement to produce.
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
Web Forms with PHP COEN 351. Displaying and processing a simple form if( array_key_exists(‘my name’,$_POST)){ print “Hello, “.$_POST[‘my_name’]; } else.
1 Chapter 6 – Creating Web Forms and Validating User Input spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information.
Overview A plain HTML document is static A CGI program is executed in real-time, so that it can output dynamic information. CGI (Common Gateway Interface)
CP3024 Lecture 3 Server Side Facilities. Lecture contents  Server side includes  Common gateway interface (CGI)  PHP Hypertext Preprocessor (PHP) pages.
CIS 706 Translators I The WIG Project Matthew Dwyer 324E Nichols Hall
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
CGI Scripting and Vulnerabilities COEN 351: E-commerce Security  Thomas Schwarz, S.J
Web Server Design Week 14 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin Klein 4/14/10.
USING PERL FOR CGI PROGRAMMING
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 7: HTTP and CGI Fundamentals of Web Programming.
Lecture 21 Common Gateway Interface CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
CSCE Systems Programming Lecture 21 Web Server: CGI -Dynamic Pages CSCE March 25, 2013.
Chapter 9: Perl and CGI Programming CGI Programming Acknowledgement: Some materials are taken from Teach Yourself CGI Programming with PERL 5 in a Week.
Chapter 6 Server-side Programming: Java Servlets
More on Variables Some related techniques. Header() function void header ( string $string [, bool $replace = true [, int $http_response_code ]] ) header()
Approaches for creating dynamic web pages Server-side processing: Server receives a request, performs all processing necessary to create a dynamic web.
Perl: Lecture 2 Advanced RE & CGI. Regular Expressions 2.
Perl CGI What is "CGI"? Common Gateway Interface A means of running an executable program via the Web. Perl have a *very* nice interface to create CGI.
CGI Scripting and Vulnerabilities COEN 351: E-commerce Security.
Form Data Encoding GET – URL encoded POST – URL encoded
Internet and Intranet Fundamentals
Netprog 2002 CGI Programming1 CGI Programming CLIENT HTTP SERVER CGI Program http request http response setenv(), dup(), fork(), exec(),...
Copyright © 2002 ProsoftTraining. All rights reserved. Java Servlets.
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
Krerk Piromsopa. 1 Department of Computer Engineering. Chulalongkorn University. Web Application Generic Issues.
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. 1 Intermediate Perl Programming Class Two Instructor:
Web Server Design Assignment #5: Unsafe Methods & CGI Due: 05/05/2010 Old Dominion University Department of Computer Science CS 495/595 Spring 2010 Martin.
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.
Pass data1 Passing data from an HTML page to a program Dr Jim Briggs.
The OWASP Foundation OWASP Education Computer based training The Basics Nishi Kumar IT Architect Specialist, FIS Chair, Software Security.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 17.
Web Server Design Week 13 Old Dominion University Department of Computer Science CS 495/595 Spring 2012 Michael L. Nelson 04/03/12.
Web Server Design Week 15 Old Dominion University Department of Computer Science CS 495/595 Spring 2009 Michael L. Nelson 4/20/09.
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.
The Common Gateway Interface (CGI) Pat Morin COMP2405.
Web & Web applications DBW 2017.
Web Protocols and Practice
CGI I: Basics Web Programming.
Introduction to CGI and ajax
Web Server Design Assignment #5: Unsafe Methods & CGI
CGI CS422 Dick Steflik.
CSCE Systems Programming
Introduction to CGI and ajax
Programming in Perl Introduction
Chapter 2 Interacting with the Customer
The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol
Environment Variables
An Example of a TCP/IP Application: the World Wide Web
Web Server Design Week 16 Old Dominion University
CGI I: Basics Web Programming.
Presentation transcript:

CGI programming Peter Verhás January 2002

What this tutorial is about Introduction to CGI programming Using ScriptBasic –Simple to program –Simple to setup on Linux or any Win Prerequisite: understanding web architecture

How to setup ScriptBasic web test environment? Install ScriptBasic Edit the configuration file –scriba.conf.lsp –Compile it using cftc.exe Start sbhttpd Start your browser (Well, this is not true CGI, but does not matter)

How is CGI Working? A new process on the web server The CGI process reads stdin and environment variables It writes the stdout

Hello World! #! /usr/bin/scriba -c include cgi.bas cgi::Header 200,"text/html" cgi::FinishHeader print """ Hello World! """ stop

Which Environment Variables? Important environment variables (from the http header) –REMOTE_ADDR –REQUEST_METHOD GET –REMOTE_HOST localhost –HTTP_USER_AGENT Mozilla/4.0 –HTTP_ACCEPT */* –HTTP_CONNECTION Keep-Alive –HTTP_ACCEPT_LANGUAGE hu –SCRIPT_NAME test.bas –SERVER_NAME localhost –SERVER_PORT 80 –CONTENT_LENGTH 0 –QUERY_STRING q=verh%E1s+%2BCGI –PATH_TRANSLATED /home/httpd/cgi-bin/test.bas

Print Out Environment Variables #! /usr/bin/scriba -c include cgi.bas cgi::Header 200,"text/html" cgi::FinishHeader print """ """ i = 0 while IsDefined( Environ(i) ) print i," ",Environ(i),"\n" i = i+1 wend print """ """ stop

What is in the QUERY_STRING? Anything that the browser sends A FORM parameters coded –parameter=value pairs joined with & –Space replaced by + –Special characters %XX hexa encoded

Print Out QUERY_STRING #! /usr/bin/scriba -c include cgi.bas cgi::Header 200,"text/html" cgi::FinishHeader print """ """ print Environ("QUERY_STRING") print """ """ stop

Getting Parameters #! /usr/bin/scriba -c include cgi.bas cgi::Header 200,"text/html" cgi::FinishHeader print """ """ print cgi::GetParam ("apple") print """ """ stop

Getting Parameters #! /usr/bin/scriba -c include cgi.bas cgi::Header 200,"text/html" cgi::FinishHeader print """ """ print cgi::PostParam ("apple") print """ """ stop

Handling Cookies

File Upload

User Authentication

Thank you for your attention.