Server-side Scripting Powering the webs favourite services.

Slides:



Advertisements
Similar presentations
HTML Forms. collect information for passing to server- side processes built up from standard widgets –text-input, radio buttons, check boxes, option lists,
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Chapter 16 The World Wide Web.
Languages for Dynamic Web Documents
Server-Side vs. Client-Side Scripting Languages
1 Chapter 12 Working With Access 2000 on the Internet.
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
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.
Web Programming Language Dr. Ken Cosh Week 1 (Introduction)
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Chapter 16 The World Wide Web. 2 Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Write basic HTML.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Chapter 1: Introduction to Web
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
With your friendly Web Developer, Chris.. Terminology  HTML - > Hypertext Markup Language  CSS -> Cascading Style Sheet  open tag  close tag  HTTP->Hypertext.
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 16 The World Wide Web. 2 The Web An infrastructure of information combined and the network software used to access it Web page A document that.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 4-1 of…
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
Lecture # 6 Forms, Widgets and Event Handling. Today Questions: From notes/reading/life? Share Personal Web Page (if not too personal) 1.Introduce: How.
JavaScript – Quiz #9 Lecture Code:
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.
Website Development with PHP and MySQL Saving Data.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter.
HTML Forms.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Web Design (1) Terminology. Coding ‘languages’ (1) HTML - Hypertext Markup Language - describes the content of a web page CSS - Cascading Style Sheets.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Overview Web Session 3 Matakuliah: Web Database Tahun: 2008.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
Web Authoring with Dreamweaver. Unit Objectives  Be able to define keywords: HTML, HTTP (protocol), browser, web server, client/server, tag, attribute,
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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.
Web Design Terminology Unit 2 STEM. 1. Accessibility – a web page or site that address the users limitations or disabilities 2. Active server page (ASP)
National College of Science & Information Technology.
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.
Intro to HTML CS 1150 Spring 2017.
Tonga Institute of Higher Education IT 141: Information Systems
Objective % Select and utilize tools to design and develop websites.
JavaScript and Ajax (Ajax Tutorial)
Intro to HTML CS 1150 Fall 2016.
Objective % Select and utilize tools to design and develop websites.
PHP / MySQL Introduction
Database Driven Websites
Tonga Institute of Higher Education IT 141: Information Systems
PHP and Forms.
Lesson 1 The Web.
Tonga Institute of Higher Education IT 141: Information Systems
Computer communications
Client-Server Model: Requesting a Web Page
Presentation transcript:

Server-side Scripting Powering the webs favourite services

Server-side scripting for web based applications Learning Intentions Understand the relationship between the browser and the web server Understand how files are requested from a web server, and how a server-side scripting language makes the contents of the pages dynamic Understand the GET method of sending an item of data with a resource location Understand how a web server can use a server-side scripting language to interact with a database to retrieve information Success Criteria I am able to explain how a web server responds to a request from a browser, and how the browser uses the HTML data I can explain how a web server dynamically generates a page using a server-side script I can explain how parameter can be passed in a GET request to send extra data between the browser and the HTTP server I can explain how a database can be used to store information that appears on a web page

Example Website We’re going to simulate what happens when a user interacts with the following sample website. index.html page2.html check.php sale.php item.php

How a URL gets turned into a request URL: GET /uk/HTTP/1.1 Host: The HTTP server will fetch a default html file if no file is specified. This will usually be some variation of index.html

Setting up your group Browser HTTP Server Internet Scripting Engine Database server Database table Query result options PHP option sheets Database query slips Request slips Blank browser window All regular html,.php and media files. Table Standing between tables Coordinator Task 1 to 5 Diagrams

Task one – static web page When a static HTML page is requested, the HTTP server will locate the file and send it back User types in url into the browser

User types in Display rendered index.html webpage Web Browser Request Get /index.html Host testserver.com Return Index.html file Internet Return Index.html file HTTP Server Task one- static web page Create page request Turn index.html description into final rendered page Find server location Find user machine location Locate index.html in http document store Request Get /index.html Host testserver.com

Task two– static web page with images When a static HTML page is requested, the HTTP server will locate the file and send it back When rendering the page, images may also need to be requested one by one using the IMG tag src as the location User clicks on the click here to access our sale link

User clicks on link Display rendered page 2 Web Browser Request Get /page2.html Host testserver.com Index.html file Internet page2.html file HTTP Server Task two- static web page with images Create page request Finish rendering final web page Find server location Find user machine location Locate index.html in http document store Request Get /page2.html Host testserver.com Create first image request Create second image request Find server location Request img/sale.png Request img/sale.png Locate img/sale.png in http document store sale.png file Find user machine location sale.png file Request img/buynow.jpg Find server location Request Img/buynow.jpg Locate img/buynow.jpg in http document store Buynow.jpg file Find user machine location Buynow.jpg file

Passing extra information to a webserver Many situations where a static page isn’t enough Need a way of passing information provided by the user to the webserver Two methods GET allows information to be added to the url POST allows information to be sent separately with the url Example Computing Science

How a URL with a parameter gets turned into a request URL: With parameter name q = computing science GET /search?q=computing+scienceHTTP/1.1 Host: Extra information the user adds by typing something in or interacting with the page gets added to the URL

Task three – server-side script request When the user types in information into a form on a webpage and clicks a button this information added to the request for the particular server-side scripted page. The scripting engine will use the information from the user and the code in server-side scripted page to generate a new custom html page. This newly generated page will be sent back to the user. Request from form is for with secret code parameter ?code=MAGICDUCKS

Scripting Engine Send check.php script with parameter code=MAGICDUCKS Return Lets go to the secret sale page html User types in MAGICDUCKS then clicks submit Display rendered lets go to the secret sale webpage Web Browser Request Get /check.php?code= MAGICDUCKS Host testserver.com Return lets go to the secret sale page html Internet Return lets go to the secret sale page html HTTP Server Create page request Turn secret sale html description into final webpage Find server location Find user machine location Locate check.php in document store Request Get /check.php?code= MAGICDUCKS Host testserver.com Task three- server side script request Execute check.php script to decide which HTML page gets created. No access or lets go to the secret sale Add the return address the generated page should be sent to

How database code in a server side script gets turned into a database query $sql = "SELECT * FROM products ORDER BY id"; $result = mysql_query($sql) or die("Error ".mysql_error($db)); SELECT * FROM products ORDER BY id What we want the database to do Sending the query to the database

Task four – Server side script with database query When a server side scripted file such as.php is requested, it may need some data from a database to help it create the html page. It connects and sends a query to the database which will return a list of records back. The database returns a set of records to the scripting engine that are used to help create the final page. User clicks on secret sale link which requests

Task four – Server side script with database query Scripting Engine Send sale.php script Return sales page html User clicks on secret sale link Display rendered sale webpage Web Browser Request Get /sale.php Host testserver.com Return sale page html Internet Return sale page html HTTP Server Create page request Turn sale html description into final webpage Find server location Find user machine location Locate sale.php in document store Request Get /sale.php Host testserver.com Execute sale.php script which needs item data from database Add the return address the generated page should be sent to Connect and send Database query SELECT * FROM products ORDER BY id Database Server Return all item records in ascending order of id Use item records to help create sales html page Search for all items in products table and put them in ascending order of id

Task five – Server side script with a parameter based database query When a server side scripted file such as.php is requested, it may need some data from a database first. The data it needs could depend on user input which will be passed as a parameter. This data is then used by the scripting engine to create a specific database query. It connects and sends this query to the database which will return a list of records back to the scripting engine. The data is used by the scripting engine to create the final html page. User clicks on Rocking horse click for more information link which requests

Task five – Server side script with a parameter based database query Scripting Engine Send item.php script with parameter id=1 Return rocking horse html User clicks on Rocking horse find out more link Display rendered Rocking horse item webpage Web Browser Request Get /item.php?id=1 Host testserver.com Return rocking horse html page Internet Return rocking horse html HTTP Server Create item.php?id=1 page request Turn rocking horse html into final page Find server location Find user machine location Locate sale.php in document store Request Get /item.php?id=1 Host testserver.com Execute item.php script which needs id=1 item from database Add the return address Connect and send database query SELECT * FROM products WHERE id = 1 Database Server Return item record with id=1 Use record to create rocking horse html page Search for item record with id=1 in the products table Create img/horse.jpg request Locate img/horse.jpg in document store Find server location Find user machine location Request Get img/horse.jpg Host testserver.com Return horse.jpg file Request Get img/horse.jpg Host testserver.com

General Model This can be used to help you remember how information may flow between different parts of a web based application.

User types in URL, clicks on link or submits form Final rendered web page Web Browser Create page request Combine html and other files to render final web page Request with server and resource html, css, javascript, media or other file Internet Find server location Find user machine location Scripting Engine combine html fragments with results of php instructions to create complete html file Request for static file html, css, javascript, media file HTTP Server Locate file in http document store Send to scripting engine for further processing Request for server side script file Fully processed html file Server side script file Fully processed html file Database query SELECT * FROM table Database Server Searches for matching records, or updates, deletes or amends information Return result of query