CGI programming Using Apache.

Slides:



Advertisements
Similar presentations
Working with Forms. how are forms manipulated? the document object contains an array of forms objects, one for each form, in document order –forms[] any.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
The Web Warrior Guide to Web Design Technologies
DT211/3 Internet Application Development Active Server Pages & IIS Web server.
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.
CS 898N – Advanced World Wide Web Technologies Lecture 6: PERL and CGI Chin-Chih Chang
Guide To UNIX Using Linux Third Edition
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.
Introduction to JavaScript. Aim To enable you to write you first JavaScript.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
CMPT Web Programming Introduction and Basic HTML.
CS 1704 Introduction to Data Structures and Software Engineering.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Creating a Basic Web Page
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.
JavaScript Teppo Räisänen LIIKE/OAMK HTML, CSS, JavaScript HTML defines the structure CSS defines the layout JavaScript is used for scripting It.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
CGI programming Using Apache. Concepts Browser prepares parameter list List is attached to name of program to run on server "submit" button sends string.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
HTML. WHAT IS HTML HTML stands for Hyper Text Markup Language HTML is not a programming language, it is a markup language A markup language is a set of.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
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.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
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.
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.
1 HTML forms (cont.)
©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.
Javascript JavaScript is what is called a client-side scripting language:  a programming language that runs inside an Internet browser (a browser is also.
Web Authoring with Dreamweaver. Unit Objectives  Be able to define keywords: HTML, HTTP (protocol), browser, web server, client/server, tag, attribute,
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.
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.
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
Basic HTML Page 1. First Open Windows Notepad to type your HTML code 2.
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
Module 1 Introduction to JavaScript
Introduction to Dynamic Web Programming
Barb Ericson Georgia Institute of Technology May 2006
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
Section 10.1 YOU WILL LEARN TO… Define scripting
Intro to PHP & Variables
Simple PHP application
Module 1 Introduction to PHP 11/30/2018 CS346 PHP.
Embedding Graphics in Web Pages
The Web Wizard’s Guide To JavaScript
CGI programming Using Apache.
Teaching slides Chapter 6.
HTML Structure.
Computer communications
Tutorial 10: Programming with javascript
An Introduction to JavaScript
Introduction to Programming and JavaScript
HTML5 - 2 Forms, Frames, Graphics.
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 <iomanip> cout << "Content-Type: text/html\n\n" << endl; cout << "<!DOCTYPE html>" << endl; // HTML 5 cout << "<html>" << endl; …. Your HTML & text go here … cout << "</html>" << endl; 1st line identifies output media type to browser 2nd line identifies document type version 3rd 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

Output is a stream representing a single "file" 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<< "<p> text <ol><li>item1</li></ol>"<<endl; Styles can be embedded or inline Generate style tags just like any other HTML cout << "<style> .red {font:red} " << endl; cout << ".bigtext {text-size:150%} " << endl; cout << " </style>" << endl;

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

Activating your CGI program Generate an HTML form (using cout or printf): <form name='myform' action="cgi-bin/your program's executable" method='post' > <!-- for testing: use action='mailto:your email address' --> … {your JS function def's and html and go here} document.myform.submit(); // this submits the form to the server <td><input onclick='chkflds();' type='button' value="multiply them!"></TD> </form> Where I have "chkflds" you could put the name of a function to validate the fields The function would have to be inside <script> and <head> tags RECOMMENDATION: put the form's elements inside a table <form> <table> .. Input/button tags here… </table></form>

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 email 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