Server-Side Application and Data Management IT IS 3105 (Spring 2010)

Slides:



Advertisements
Similar presentations
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Advertisements

Adding Dynamic Content to your Web Site
Introduction to PHP To boldly go where JavaScript has never been…
DT211/3 Internet Application Development Active Server Pages & IIS Web server.
Creating WordPress Websites. Creating a site on your computer Local server Local WordPress installation Setting Up Dreamweaver.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
Multiple Tiers in Action
Introduction to Web Based Application. Web-based application TCP/IP (HTTP) protocol Using WWW technology & software Distributed environment.
Apache Tomcat Server Typical html Request/Response cycle
The World Wide Web and the Internet Dr Jim Briggs 1WUCM1.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
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.
1 John Magee 9 November 2012 CS120 Lecture 17a: Publishing Web pages.
Introduction to Internet Programming (Web Based Application)
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.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Web Architecture Introduction
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
How Web Database Architectures Work CPS181s April 8, 2003.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
How CGI and Java Servlets are Run By David Stein 14 November 2006.
CGS 3066: Web Programming and Design Spring 2016 Introduction to Server-Side Programming.
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)
PHP using MySQL Database for Web Development (part II)
CGS 3066: Web Programming and Design Spring 2017
Java Server Pages Can web pages be created specially for each user?
Introduction to Internet Programming (Web Based Application)
Section 6.3 Server-side Scripting
WWW and HTTP King Fahd University of Petroleum & Minerals
Web Development Web Servers.
Introduction and Principles
IS1500: Introduction to Web Development
Servlet Fudamentals.
PHP / MySQL Introduction
MapServer In its most basic form, MapServer is a CGI program that sits inactive on your Web server. When a request is sent to MapServer, it uses.
Server-Side Application and Data Management IT IS 3105 (Spring 2010)
Web App vs Mobile App.
Database Driven Websites
Server Side Programming Overview And file system basics
ISC440: Web Programming 2 Server-side Scripting PHP 3
Web Browser server client 3-Tier Architecture Apache web server PHP
Chapter 27 WWW and HTTP.
Lecture 1: Multi-tier Architecture Overview
Introduction to Servlets
PHP and Forms.
COP 4610L: Applications in the Enterprise Spring 2005
IntroductionToPHP Static vs. Dynamic websites
Lecture 5: Functions and Parameters
Tutorial 6 PHP & MySQL Li Xu
Client-Server Model: Requesting a Web Page
CS205 Tables & Forms © 2012 D. J. Foreman.
CS205 Tables & Forms © 2008 D. J. Foreman.
Information Retrieval and Web Design
Web Servers (IIS and Apache)
CS205 Tables & Forms © 2004 D. J. Foreman.
PHP By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and.
Web Application Development Using PHP
Presentation transcript:

Server-Side Application and Data Management IT IS 3105 (Spring 2010) Lecture 2

LAMP/WAMP Architecture LAMP: Linux, Apache, MySQL, and PHP WAMP: Windows, Apache, MySQL, and PHP HTTP Request: http://www.abc.com/site.php HTTP Response Apache Web Browser MySQL PHP Operating System Result Set SQL Query Operating System Server Client

CGI Common Gateway Interface

CGI: Common Gateway Interface Common Gateway Interface (CGI) A standard for interfacing external applications with information servers, such as HTTP or Web servers Plain HTML documents that a Web server retrieves are static They exist in a constant state A text file that doesn't change without human intervention CGI programs are executed in real-time They can output dynamic information responding to client requests

CGI: Common Gateway Interface Static Web Pages Client browser requests a static web page from a web server Web server looks for the file locally or on a file server File returned to web server Server returns file to browser Browser displays content http request http response

CGI: Common Gateway Interface Dynamic Client browser requests a file from a web server Web server notices this file is special – it is executable The web server must be configured for this The file is executed Request parameters (if present) are examined External data is retrived (if requested) Response is generated Typically a customized HTML file Server returns generated data to browser Browser displays content Executable program RDB

CGI Basics Run any executable program C

C vs Java C – Compiled Pros Cons One time compile Runs fast Must be loaded every time it executes Can be a slow process Must be recompiled for every change Executable will only run on one platform May be difficult to port to another platform

C vs Java Java – “interpreted” Cons Pros “Interpreted” Runs slower Still need a compilation Pros Once loaded stays loaded Fast second and subsequential runs Compiled p-code OS/HW indepenent

Typical CGI development Spec/Design the solution Base/Navigation/Intermediate HTML pages Typically static pages Spec/Design HTML pages with forms Pass data to CGI programs GET vs POST GET: Pass data as part of the URL Visible Used for Idempotent requests, Static requests Requests that don’t change the server state e.g. don’t write data to the server POST Pass date as part of the HTTP request More secure Used when the state of the server may be changed Write data to the server Create and “order”

Typical CGI development Design the solution (cont) Spec/Design the executable code Choose a program language Must be able to write to STDOUT Typical choices: C/C++ Fortran PERL TCL Any Unix shell Visual Basic AppleScript

Design the solution (cont) Spec/Design the executable code (cont) Write code to extract the data passed from the Form If appropriate Process the data from the form Retrieve data from the database Create the HTML to send back to the Client

Example (php) http://sis-43spp11-pc/grades/grades.htm Note how the program is called in this top level page http://sis-43spp11- pc/grades/Add_Student_Form.htm Note how the program is called in this case

<html> <head><title>Display Students</title></head> <body> <h1>List of Students</h1><hr> <table dir="ltr" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" width="1%“> </td> <td valign="top" width="24"></td> <td valign="top"> <?php $server = 'localhost‘; $user = 'root‘; $pass = 'xyz'; $mydb = 'gradesdb'; $connect = mysql_connect($server, $user, $pass); if (!$connect){ die ("Cannot connect to $server using $user"); } else { $sqlcommand = "select * from students"; $con_results = mysql_select_db ($mydb); if (!$con_results) { print "con results: $con_results\n“; die ("Could not connect to db"); } print "<br>The query is: $sqlcommand<br>"; $results_id = mysql_query($sqlcommand, $connect); if (!$results_id) { // did it get the data print "results_id: $results_id <br>\n“; die ("Could not select students from db"); // no! else { // got it! print "<p>Students in database</p>\n"; print "<table border='1'>\n"; print "<tr>\n"; print " <th>ID</th>\n“; print " <th>First Name</th>\n“; print " <th>Last Name</th>\n"; print "</tr>\n"; while ($row = mysql_fetch_row($results_id)) { foreach ($row as $field) // note the foreach! { print " <td>$field</td>\n“; } } // end while print "</table>\n"; } // end if..else.. results_id } // end if..else.. con_results } // end if..else.. connect ?> <p><a href="grades.htm">Return to Main</a></p> </td> </tr> </table> <hr> </body> </html>

Display Students.php Display_students.php