CGI programming Using Apache. Concepts Browser prepares parameter list List is attached to name of program to run on server "submit" button sends string.

Slides:



Advertisements
Similar presentations
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Advertisements

Creating a Form with Selection Menus The SELECT control creates a selection menu This control only allows the visitor to choose pre-defined choices There.
CPSC 203 Introduction to Computers Tutorial 59 & 64 By Jie (Jeff) Gao.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
JavaScript 101 Lesson 01: Writing Your First JavaScript.
JavaScript Forms Form Validation Cookies CGI Programs.
CM143 - Web Week 2 Basic HTML. Links and Image Tags.
Python and Web Programming
Simple PHP application. A simple application We are going to develop a simple PHP application with a Web interface. The user enters two numbers and the.
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.
CGI programming Using Apache. Concepts Browser prepares parameter list List is attached to name of program to run on server "submit" button sends string.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
CS 1704 Introduction to Data Structures and Software Engineering.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Web Design Using HTML Codes. WHAT DO I NEED TO BEGIN DESIGNING A HOME PAGE? 1.YOU NEED A FOLDER (also called a DIRECTORY) You should set up a folder or.
DAT602 Database Application Development Lecture 14 HTML.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
CPSC 203 Introduction to Computers Lab 21, 22 By Jie Gao.
1 HTML References: A HTML Tutorial: /HTMLPrimer.html
CIS 451: HTML Frames Adapted from materials developed by Dr. Soe (updated January, 2009)
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
2 1 Sending Data Using a Hyperlink CGI/Perl Programming By Diane Zak.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 6.
CPSC 203 Introduction to Computers Lab 23 By Jie Gao.
HTML Hyper Text Markup Language A simple introduction.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Website Development with PHP and MySQL Saving Data.
JavaScript. During the last lecture We looked at the utility of forms on Web pages We found out about the various components that are used in a form We.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
1 HTML Forms
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
1 © Copyright 2000 Ethel Schuster The Web… in 15 minutes Ethel Schuster
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
Introduction to JavaScript CS101 Introduction to Computing.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
HTML.
Implementing and Using the SIRWEB Interface Setup of the CGI script and web procfile Connecting to your database using HTML Retrieving data using the CGI.
Introduction into JavaScript Java 1 JavaScript JavaScript programs run from within an HTML document The statements that make up a program in an HTML.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Are You Smarter Than a 5 th Grader? 1,000,000 5th Grade HTML 5th Grade Syntax 4th Grade HTML 4th Grade Syntax 3rd Grade HTML 3rd Grade Syntax 2nd Grade.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Form Processing Week Four. Form Processing Concepts The principal tool used to process Web forms stored on UNIX servers is a CGI (Common Gateway Interface)
HTML Forms.
Web Authoring with Dreamweaver. Unit Objectives  Be able to define keywords: HTML, HTTP (protocol), browser, web server, client/server, tag, attribute,
Compare and Contrast : Blackboard & a Personal Web Page www3.ltu.edu/~s_schneider/howto/faculty.htm You’ll find this presentation (and another) here :
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring Forms, HTML5 layout.
HTML Hyper Text Markup Language. The Basics u HTML documents contain “tags” which instruct the Browser software on how to present the information within.
PHP Syntax You cannot view the PHP source code by selecting "View source" in the browser - you will only see the output from the PHP file, which is plain.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring Forms, HTML5 layout.
HTML-I Basic HTML Elements. HTML (Hyper Text Markup Language) HTML is a document layout and hyperlink- specification language. i.e. a language used to.
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.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Creating Web Pages with Links, Images, and Embedded Style Sheets
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
HTML Hyper Text Markup Language. Agenda Basics Tools Important tags Tables & databases Forms Publishing at Stern.
Basic HTML Page 1. First Open Windows Notepad to type your HTML code 2.
Basic Web Design UVI CELL Dave Gilliss Dave Gilliss
CGI programming Using Apache.
CGI programming Using Apache.
HTML Structure.
Tutorial 10: Programming with javascript
Presentation transcript:

CGI programming Using Apache

Concepts Browser prepares parameter list List is attached to name of program to run on server "submit" button sends string to server as name/value pairs Server locates program in CGI directory Server loads program Server passes string to program Program processes parameters and acts as needed Program creates strings and outputs to server One line of HTML code per output statement (cout, printf, etc) ALL stream output goes to the Server Server sends strings to browser Browser interprets the HTML code & displays the "page"

CGI output (C++ example) #include cout << "Content-Type: text/html\n\n" << endl; cout " << endl; // HTML 5 cout " << endl; …. Your HTML & text go here … cout " << endl; 1 st line identifies output media type to browser 2 nd line identifies document type version 3 rd line is actual start of the page

Content-type problems Inability of data source to identify content Wrong file extension Bad file extension Extension collisions Ambiguous container formats Ambiguous magic numbers Inability of receiver to trust sender's media type Programmers try to guess content type by examination

Using styles Output is a stream representing a single "file" HTML files do NOT have to have one tag per line Output can be individual lines or several long lines: cout text item1 "<<endl; Styles can be embedded or inline Generate style tags just like any other HTML cout.red {font:red} " << endl; cout << ".bigtext {text-size:150%} " << endl; " << endl;

Using JavaScript JS can be inserted: as functions in As inline code inside in body of doc CGI generated pages "act like" real pages

Activating your CGI program Generate an HTML form (using cout or printf): … {your JS function def's and html and go here} document.myform.submit(); // this submits the form to the browser Where I have "chkflds" you could put the name of a function to validate the fields The function would have to be inside and tags RECOMMENDATION: put the form's elements inside a table.. Input/button tags here…

Setting up your Apache server Open terminal window Type: nano /etc/httpd/conf/httpd.conf (or use your favorite editor instead of nano) Locate "ServerAdmin" and replace the address with yours Locate "ServerName" and replace the default with your TJWnnn account (tjwnnn.cc.binghamton.edu) Save the file using the same name it had In the terminal window type the following command: apachectl start Close your session

Testing your web server Create a simple web page Save it in /var/www/html with the name: index.html Open a browser on your own PC (NOT on the TJW machine) Enter the address of your tjw account e.g.; tjw241.cc.binghamton.edu (that's mine!!) You should now see your test page