CSCB20 Week 8. Introduction to Database and Web Application Programming. Anna Bretscher* Winter 2016

Size: px
Start display at page:

Download "CSCB20 Week 8. Introduction to Database and Web Application Programming. Anna Bretscher* Winter 2016"

Transcription

1 CSCB20 Week 8 Introduction to Database and Web Application Programming Anna Bretscher* Winter 2016 *thanks to Alan Rosselet for providing the slides these are adapted from.

2 Web Programming We have seen how HTML and CSS work together to create a Web page (HTML) with styling details applied (CSS) When you type a URL for an HTML document into a browser window: o browser sends a request to the server (mathlab in this case), o the server locates the requested file (test.html), o sends that file back to the browser to be rendered Rather than providing the name of a file in a URL, it is possible to give the name of a program: o server executes the program o sends its output back to the browser to be rendered, e.g.: /hello.php

3 What is PHP? PHP == PHP Hypertext Preprocessor. o Free and open-source, server-side scripting language designed specifically for the Web o Used to generate dynamic web-pages o Supported by most Web servers PHP scripts o are bracketed by reserved PHP tags o supports embedding of PHP scripts within HTML pages o easy to learn operational behavior and common patterns for working with Web pages

4 PHP Overview (cont d) Interpreted language Scripts are parsed at run-time rather than compiled beforehand Executed on the server-side Source-code not visible to client View Source in browsers does not display PHP code, only output produced by PHP code Various built-in functions allow for fast development Compatible with many popular databases

5 LAMP (Linux, Apache, MySQL, PHP) is a common Web application platform all components are free, open-source Syntax Perl- and C-like syntax. Relatively easy to learn Large function library PHP Overview Embedded directly into HTML Interpreted, no need to compile Loosely typed, like Python and JavaScript CSCB20 Databases and PHP 5

6 Why PHP? PHP is but one of many server-side languages for developing dynamic Web app s, other options include: o Java Servlets with JSP, Ruby on Rails, ASP.Net Why choose PHP? o easy deployment no complex infrastructure to set up o compatible: supported by most popular Web servers o simple: lots of built-in functionality; familiar syntax o free and open source: anyone can run a PHPenabled server free of charge o available: installed on most commercial Web hosts, and on UTSC servers, including mathlab

7 PHP Web Page Request Lifecycle browser requests.html file (static content); o server sends file content browser requests.php file (dynamic content); o server reads file, o executes any embedded script content, o sends output of script back to browser.

8 What does PHP code look like? Structurally similar to C/C++, Java Supports procedural and object- oriented paradigms All PHP statements end with a semi- colon Each PHP script must be enclosed in the reserved PHP tag, denoted by <?php?> PHP code block may contain statements, funcjon definijons, variable- value references

9 Hello World in PHP <!- hello.php --> <html><body> <strong>hello World!</strong><br /> <?php print "<h2>hello, World</h2>";?> </body></html> Output generated by PHP print and echo statements is inserted into the HTML returned to the browser. Q. How do you view the output of a PHP script from a browser? Place hello.php in your cscb20w16_space directory, then view in a browser with URL:

10 Variables in PHP PHP variables begin with a $ sign, both for declaration and value reference Case-sensitive ($Foo!= $foo!= $foo) Global and locally-scoped variables o global variables can be used anywhere o local variables restricted to a function or class Certain variable names reserved by PHP o Form variables ($_POST, $_GET) o Server variables ($_SERVER) o Etc.

11 Variable Usage and Comments <?php $foo = 25; // Numerical variable $bar = Hello ; // String variable $foo = ($foo * 7); // Multiplies foo by 7 $bar = ($bar * 7); // Invalid expression?> single-line comments are written as one of: // single-line comment # single-line comment multi-line comments bracketed by /* multi-line comment... */

12 Data Types PHP is a loosely-typed language, like Python PHP basic types are: o int, float, boolean, string, array, object, NULL o functions is_type() test whether a variable has a certain type, e.g. is_string($myvar) Conversion between types is automatic in many cases, e.g.: o string to int for + o int to float for / Types can be cast to another type using: $int_val = (int) 33 ;

13 Strings $myvar = "hello"; print $myvar[1]; # prints e square bracket notation for 0-based indexing catenation using. operator (not + ) print $myvar. "world"; # prints hello world strings quoted with double quotes are interpreted, meaning that embedded variables have their values inserted strings quoted with single quotes are not interpreted print "$myvar world"; # prints hello world print '$myvar world'; # prints $myvar world

14 for loop for (initialization; condition; update) { statements uses same syntax as Java for ($i = 10; $i >= 0; $i--) { print "$i cubed is ". $i * $i * $i. ".\n";

15 for loop for (initialization; condition; update) { statements uses same syntax as Java $name = "preprocessor"; for ($i = 0; $i < strlen($name); $i++) { print "The next letter is".{$name[$i]\n";

16 if/else statement if (condition) { statements; elseif (condition) { statements; else { statements; <?php if ($user== John ) { print Hello John. ; else { print You aren t John. ;?> elseif clause and else clause are both optional multiple elseif clauses may be used

17 while loop same syntax as Java while (condition) { statements; do { or statements; while (condition) <?php $count=0; while($count<3) { print hello PHP. ; $count += 1; // or // $count = $count + 1; // or // $count++;?> hello PHP. hello PHP. hello PHP.

18 Arrays (ie, lists) $myvar = array(); # create new array $myvar = array(val0, val1,..., valn); $myvar[index]; # element at position index $myvar[index] = val0; # assign element at index $myvar[] = valn; # append valn $a1 = array(); # empty, length-0 array $a[2] = 12; # store 12 in 3 rd position of array $a2 = array("a", "sequence", "of", "strings"); $a2[] = "the end"; # new last element of $a2

19 foreach loop foreach ($array as $element) {... Similar to Pythonʼ s: for element in array: Simpler than regular for loop when using arrays $a = array("a", "sequence", "of", "strings"); for ($i = 0; i < count($a); $i++) { print "the next word is {$a[$i]\n"; foreach ($a as $element) { print "the next word is $element\n";

20 Embedded PHP We could use PHP print and/or echo statements to generate HTML output, e.g. <?php print "<html>\n<head>\n"; print "<title>php Squares</title>\n";... for ($i = 0; i <= 10; $i++) { print "<p>$i squared is $i*$i</p>\n";?> What s wrong with this approach? Suppose you want to change the page HTML

21 Embedding PHP in HTML Write HTML literally. When scripting is needed to compute a value, embed PHP code. General format of a PHP script written within HTML file: HTML elements... <!-- output as HTML --> <?php PHP code... # output embedded within HTML?> HTML elements... <?php PHP code...?> HTML elements...

22 Embedding PHP in HTML General format of a PHP script written within HTML file: HTML elements... <!-- output as HTML --> <?php PHP code... # output embedded within HTML?> HTML elements... The PHP code in an embedded block may consist of statements, declarations, or expression values. Here s a sample expression block: <?= $myvar?> which is equivalent to <?php print $myvar;?>

23 Embedding PHP in HTML Hereʼ s our earlier squares calculator, with poor style print statements: <?php?> print "<html>\n<head>\n"; print "<title>php Squares</title>\n";... for ($i = 0; i <= 10; $i++) { print "<p>$i squared is $i*$i</p>\n";

24 Embedding PHP in HTML Hereʼ s our earlier squares calculator, now without print statements: <html><head> <title>php Squares</title>... <?php for ($i = 0; $i <= 10; $i++) {?> <p><?= $i?> squared is <?= $i*$i?> </p> <?php?>... </html>

25 Functions Functions must be defined before then can be called. Function headers are of the format: function functionname($arg_1, $arg_2,, $arg_n) Note that no return type is specified. function quadratic($a, $b, $c) { return -$b + sqrt($b*$b - 4*$a*$c) / (2*$a); $x = -2; $y = 3; $root = quadratic(1, $x, $y-2); Unlike variables, function names are not case sensitive foo( ) == Foo( ) == FoO( )

26 Query Strings and Parameters We refer to Web pages using URL s (Uniform Resource Locators), of the form We can specify parameters to PHP scripts by appending a value to the end of the URL: Parameter name=value pairs follow the? at the end of the URL path_value, in 2 nd example param name is film, value is vampire Provides a mechanism by which a user can control/customize the behavior of a server-side PHP script

27 Query Strings and Parameters PHP can retrieve parameter values using the $_REQUEST array: $_REQUEST["parameter_name"] Returns the parameter s value as a string Can check to see if a specific parameter is set using isset(): $country_name = $_REQUEST["country"]; $population = (int) $_REQUEST["population"]; if (isset($_request["code"])) { $code = (int) $_REQUEST["code"]; else { $code = -1;

28 Reading Files Two ways to read the contents of a text file: 1. file( my_file.txt ); returns array of lines in my_file.txt 2. file_get_contents( my_file.txt ); returns a single string containing all lines in my_file.txt <?php # display lines from file as a bulleted list $cities = file("cities.txt"); foreach ($cities as $city) {?> <li> <?= $city?> </li> <?php?>

29 Unpacking Arrays, Splitting Strings Sometimes it is useful to be able to refer to the elements of an array by individual variable names, rather than using indices $movie_info = file("info.txt"); list($title,$year) = $movie_info; # now can use $title rather than $movie_info[0] A string consisting of delimited values can be split (same idea as in Python) $title = "Databases and Web Programming"; $words = explode(" ", $title);

30 Reading Directories If your application needs to read from a set of files in a directory, how can your code automatically detect and read the specific files present? glob enables you to use pattern matching to select files $notes = glob("note_*.txt"); foreach ($notes as $note) { print $note; * is just one of several regular expression patternmatching forms (others include matching on character ranges, matching digits, optional characters)

31 Web Services In Assignment 2 we will use PHP embedded within an HTML document to implement dynamic HTML content However, HTML is only one of several kinds of data a server could produce for use by a client A Web service refers to use of the Web s HTTP protocol to invoke programs and retrieve their results The general idea is that we should be able to call programs using URL references, just as we do to refer to Web pages Like tradijonal funcjons, Web- service programs can take parameters and produce results, which may be wrixen as HTML, but also as XML, JSON, plain text, or other formats

32 Web Services and PHP The type of output produced by a Web service must be explicitly specified, since it can take different The client needs to know how to interpret the byte values returned by the server HTTP, the Internet protocol used for Web URL requests and responses, provides a Content-type header for this purpose In PHP, the type of the result value(s) defaults to HTML ( text/ html ), but can be explicitly specified using: header("content-type: type/subtype"); The header() function must be called before a PHP script generates any output (since the client who called the script needs the header information to interpret that output)

33 MIME Content- Types MIME types are used to communicate the type of data sent by a server to a client (e.g. a jpeg image, or an html file), and vice versa (e.g. a file upload from a client) MIME types are specified in two parts: type/subtype, e.g.: MIME type related file extension text/plain.txt text/html.html,.htm,... text/css.css application/ json image/png.png image/jpg.jpeg,.jpg,.jpe text/javascript.js

34 A PHP Web service Let s examine a simple example of a PHP Web service that take base and exp parameters, and returns the base raised to the exp (exponent) power. A URL to invoke this service might look like this: hxps://mathlab /cscb20w16/utorid/power.php?base=5&exp=3 How would we implement this service in PHP? <?php header("content-type: text/plain");?> $base = (int) $_GET["base"]; $exp = (int) $_GET["exp"]; $result = pow($base, $exp); print $result;

35 Web Service Errors When implementing a Web service, we must make provision for errors, such as omission of a required parameter or an invalid parameter value. E.g. /utorid/power.php?base=5&exp=w /utorid/power.php?base=5 How should such an error be reported? We could return an HTML error message, but what if the client (caller) takes the result and displays it in a result <div> on their Web page, now they display an opaque error message where the user expects a number We need a mechanism that will enable the caller to detect that the result is an error, as opposed to a result value.

36 HTTP Status Codes The Web s HTTP protocol provides a mechanism for signaling the outcome of a request, that can be used for both ordinary Web pages (e.g. 404 Not Found), and for Web services (e.g. 400 illegal request) HTTP code 200 OK Meaning page has moved (temporarily or permanently) 400 illegal request 401 authentication required 403 you are forbidden to access this page 404 page not found 410 gone; missing data or resource 500 internal server error

37 A Web Service with Error Handling We could rewrite the power() Web service to detect missing or invalid parameters as follows: <?php $base = $_GET["base"]; $exp = $_GET["exp"]; if (is_numeric($base) and is_numeric($exp)) { header("content-type: text/plain");... as before for valid input... else { header("http/ Invalid Request"); die("invalid request; required parameters");?>

38 Web Service Output Types So far, our Web service examples have output values expressed as MIME type text/plain. More commonly, a Web service invoked from a Web page will return an HTML fragment, XML data, or JSON data. Why an HTML fragment? Because normally the result returned by a Web service will be inserted into an existing HTML document, e.g. as the content of a <div>

39 Web Service Output Types Suppose we want to generate an HTML list of factorial values, up to a user-supplied value of n : <?php header("content-type: text/html"); $limit = (int) $_GET["n"]; $fact = 1; for ($i = 1; $i < $limit; $i++) {?> <li>factorial of <?= $i?> is <?= $fact?> </ li> <?php $fact = $fact * $i;?> Later we ll look at how an HTML fragment, like the one generated by this script could be inserted into a Web page

CSCB20 Week 8. Introduction to Database and Web Application Programming. Anna Bretscher* Winter 2017

CSCB20 Week 8. Introduction to Database and Web Application Programming. Anna Bretscher* Winter 2017 CSCB20 Week 8 Introduction to Database and Web Application Programming Anna Bretscher* Winter 2017 *thanks to Alan Rosselet for providing the slides these are adapted from. Web Programming We have seen

More information

Server side basics CS380

Server side basics CS380 1 Server side basics URLs and web servers 2 http://server/path/file Usually when you type a URL in your browser: Your computer looks up the server's IP address using DNS Your browser connects to that IP

More information

Web Programming Step by Step

Web Programming Step by Step Web Programming Step by Step Lecture 22 Web 2.0 and Web Services Except where otherwise noted, the contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller. What is "Web 2.0"? Web

More information

URLs and web servers. Server side basics. URLs and web servers (cont.) URLs and web servers (cont.) Usually when you type a URL in your browser:

URLs and web servers. Server side basics. URLs and web servers (cont.) URLs and web servers (cont.) Usually when you type a URL in your browser: URLs and web servers 2 1 Server side basics http://server/path/file Usually when you type a URL in your browser: Your computer looks up the server's IP address using DNS Your browser connects to that IP

More information

CSE 154 LECTURE 17: WEB SERVICES

CSE 154 LECTURE 17: WEB SERVICES CSE 154 LECTURE 17: WEB SERVICES What is a web service? web service: software functionality that can be invoked through the internet using common protocols like a remote function(s) you can call by contacting

More information

PHP by Pearson Education, Inc. All Rights Reserved.

PHP by Pearson Education, Inc. All Rights Reserved. PHP 1992-2012 by Pearson Education, Inc. All Client-side Languages User-agent (web browser) requests a web page JavaScript is executed on PC http request Can affect the Browser and the page itself http

More information

Lecture 12. PHP. cp476 PHP

Lecture 12. PHP. cp476 PHP Lecture 12. PHP 1. Origins of PHP 2. Overview of PHP 3. General Syntactic Characteristics 4. Primitives, Operations, and Expressions 5. Control Statements 6. Arrays 7. User-Defined Functions 8. Objects

More information

Server side basics CSC 210

Server side basics CSC 210 1 Server side basics Be careful 2 Do not type any command starting with sudo into a terminal attached to a university computer. You have complete control over you AWS server, just as you have complete

More information

PHP. Interactive Web Systems

PHP. Interactive Web Systems PHP Interactive Web Systems PHP PHP is an open-source server side scripting language. PHP stands for PHP: Hypertext Preprocessor One of the most popular server side languages Second most popular on GitHub

More information

PHP Hypertext Preprocessor

PHP Hypertext Preprocessor PHP Hypertext Preprocessor A brief survey Stefano Fontanelli stefano.fontanelli@sssup.it January 16, 2009 Stefano Fontanelli stefano.fontanelli@sssup.it PHP Hypertext Preprocessor January 16, 2009 1 /

More information

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later

More information

Web Scripting using PHP

Web Scripting using PHP Web Scripting using PHP Server side scripting No Scripting example - how it works... User on a machine somewhere Server machine So what is a Server Side Scripting Language? Programming language code embedded

More information

PHP 1. Introduction Temasek Polytechnic

PHP 1. Introduction Temasek Polytechnic PHP 1 Introduction Temasek Polytechnic Background Open Source Apache License Free to redistribute with/without source code http://www.apache.org/license.txt Backed by Zend Corporation http://www.zend.com

More information

What is PHP? [1] Figure 1 [1]

What is PHP? [1] Figure 1 [1] PHP What is PHP? [1] PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use Figure

More information

Web Programming Paper Solution (Chapter wise)

Web Programming Paper Solution (Chapter wise) Introduction to web technology Three tier/ n-tier architecture of web multitier architecture (often referred to as n-tier architecture) is a client server architecture in which presentation, application

More information

Lecture 7 PHP Basics. Web Engineering CC 552

Lecture 7 PHP Basics. Web Engineering CC 552 Lecture 7 PHP Basics Web Engineering CC 552 Overview n Overview of PHP n Syntactic Characteristics n Primitives n Output n Control statements n Arrays n Functions n WampServer Origins and uses of PHP n

More information

Part I. Web Technologies for Interactive Multimedia

Part I. Web Technologies for Interactive Multimedia Multimedia im Netz Wintersemester 2012/2013 Part I Web Technologies for Interactive Multimedia 1 Chapter 2: Interactive Web Applications 2.1! Interactivity and Multimedia in the WWW architecture 2.2! Server-Side

More information

PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37)

PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37) PHP Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37) A Server-side Scripting Programming Language An Introduction What is PHP? PHP stands for PHP: Hypertext Preprocessor. It is a server-side

More information

Chapter 7:- PHP. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

Chapter 7:- PHP. Compiled By:- Sanjay Patel Assistant Professor, SVBIT. Chapter 7:- PHP Compiled By:- Assistant Professor, SVBIT. Outline Starting to script on server side, Arrays, Function and forms, Advance PHP Databases:-Basic command with PHP examples, Connection to server,

More information

1.1 A Brief Intro to the Internet

1.1 A Brief Intro to the Internet 1.1 A Brief Intro to the Internet - Origins - ARPAnet - late 1960s and early 1970s - Network reliability - For ARPA-funded research organizations - BITnet, CSnet - late 1970s & early 1980s - email and

More information

3. WWW and HTTP. Fig.3.1 Architecture of WWW

3. WWW and HTTP. Fig.3.1 Architecture of WWW 3. WWW and HTTP The World Wide Web (WWW) is a repository of information linked together from points all over the world. The WWW has a unique combination of flexibility, portability, and user-friendly features

More information

PHP: Hypertext Preprocessor. A tutorial Introduction

PHP: Hypertext Preprocessor. A tutorial Introduction PHP: Hypertext Preprocessor A tutorial Introduction Introduction PHP is a server side scripting language Primarily used for generating dynamic web pages and providing rich web services PHP5 is also evolving

More information

XML Processing & Web Services. Husni Husni.trunojoyo.ac.id

XML Processing & Web Services. Husni Husni.trunojoyo.ac.id XML Processing & Web Services Husni Husni.trunojoyo.ac.id Based on Randy Connolly and Ricardo Hoar Fundamentals of Web Development, Pearson Education, 2015 Objectives 1 XML Overview 2 XML Processing 3

More information

PHP. MIT 6.470, IAP 2010 Yafim Landa

PHP. MIT 6.470, IAP 2010 Yafim Landa PHP MIT 6.470, IAP 2010 Yafim Landa (landa@mit.edu) LAMP We ll use Linux, Apache, MySQL, and PHP for this course There are alternatives Windows with IIS and ASP Java with Tomcat Other database systems

More information

Java Bytecode (binary file)

Java Bytecode (binary file) Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 11 Outline A Simple PHP Example Overview of Basic Features of PHP Overview of PHP Database Programming Slide 11-2 Web Database Programming Using PHP Techniques for programming dynamic features

More information

Web Engineering (Lecture 08) WAMP

Web Engineering (Lecture 08) WAMP Web Engineering (Lecture 08) WAMP By: Mr. Sadiq Shah Lecturer (CS) Class BS(IT)-6 th semester WAMP WAMP is all-in-one Apache/MySQL/PHP package WAMP stands for: i) Windows ii) iii) iv) Apache MySql PHP

More information

1.1 A Brief Intro to the Internet

1.1 A Brief Intro to the Internet 1.1 A Brief Intro to the Internet - Origins - ARPAnet - late 1960s and early 1970s - Network reliability - For ARPA-funded research organizations - BITnet, CSnet - late 1970s & early 1980s - email and

More information

Reading How the Web Works

Reading How the Web Works Reading 1.3 - How the Web Works By Jonathan Lane Introduction Every so often, you get offered a behind-the-scenes look at the cogs and fan belts behind the action. Today is your lucky day. In this article

More information

Module 3 Web Component

Module 3 Web Component Module 3 Component Model Objectives Describe the role of web components in a Java EE application Define the HTTP request-response model Compare Java servlets and JSP components Describe the basic session

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

PHP Reference. To access MySQL manually, run the following command on the machine, called Sources, where MySQL and PhP have been installed:

PHP Reference. To access MySQL manually, run the following command on the machine, called Sources, where MySQL and PhP have been installed: PHP Reference 1 Preface This tutorial is designed to teach you all the PHP commands and constructs you need to complete your PHP project assignment. It is assumed that you have never programmed in PHP

More information

Chapter 11 Outline. A Simple PHP Example Overview of Basic Features of PHP Overview of PHP Database Programming. Slide 11-2

Chapter 11 Outline. A Simple PHP Example Overview of Basic Features of PHP Overview of PHP Database Programming. Slide 11-2 Chapter 11 Outline A Simple PHP Example Overview of Basic Features of PHP Overview of PHP Database Programming Slide 11-2 1 Web Database Programming Using PHP Techniques for programming dynamic features

More information

Inf 202 Introduction to Data and Databases (Spring 2010)

Inf 202 Introduction to Data and Databases (Spring 2010) Inf 202 Introduction to Data and Databases (Spring 2010) Jagdish S. Gangolly Informatics CCI SUNY Albany April 22, 2010 Database Processing Applications Standard Database Processing Client/Server Environment

More information

LOON. Language Reference Manual THE LANGUAGE OF OBJECT NOTATION. Kyle Hughes, Jack Ricci, Chelci Houston-Borroughs, Niles Christensen, Habin Lee

LOON. Language Reference Manual THE LANGUAGE OF OBJECT NOTATION. Kyle Hughes, Jack Ricci, Chelci Houston-Borroughs, Niles Christensen, Habin Lee LOON THE LANGUAGE OF OBJECT NOTATION Language Reference Manual Kyle Hughes, Jack Ricci, Chelci Houston-Borroughs, Niles Christensen, Habin Lee October 2017 1 Contents 1 Introduction 3 2 Types 4 2.1 JSON............................................

More information

CS6501 IP Unit IV Page 1

CS6501 IP Unit IV Page 1 CS6501 Internet Programming Unit IV Part - A 1. What is PHP? PHP - Hypertext Preprocessor -one of the most popular server-side scripting languages for creating dynamic Web pages. - an open-source technology

More information

CNIT 129S: Securing Web Applications. Ch 3: Web Application Technologies

CNIT 129S: Securing Web Applications. Ch 3: Web Application Technologies CNIT 129S: Securing Web Applications Ch 3: Web Application Technologies HTTP Hypertext Transfer Protocol (HTTP) Connectionless protocol Client sends an HTTP request to a Web server Gets an HTTP response

More information

INTERNET PROGRAMMING. Software Engineering Branch / 4 th Class Computer Engineering Department University of Technology

INTERNET PROGRAMMING. Software Engineering Branch / 4 th Class Computer Engineering Department University of Technology INTERNET PROGRAMMING Software Engineering Branch / 4 th Class Computer Engineering Department University of Technology OUTLINES PHP Basic 2 ARCHITECTURE OF INTERNET database mysql server-side programming

More information

1.1 A Brief Intro to the Internet

1.1 A Brief Intro to the Internet 1.1 A Brief Intro to the Internet - Origins - ARPAnet - late 1960s and early 1970s - Network reliability - For ARPA-funded research organizations - BITnet, CSnet - late 1970s & early 1980s - email and

More information

Java Applets, etc. Instructor: Dmitri A. Gusev. Fall Lecture 25, December 5, CS 502: Computers and Communications Technology

Java Applets, etc. Instructor: Dmitri A. Gusev. Fall Lecture 25, December 5, CS 502: Computers and Communications Technology Java Applets, etc. Instructor: Dmitri A. Gusev Fall 2007 CS 502: Computers and Communications Technology Lecture 25, December 5, 2007 CGI (Common Gateway Interface) CGI is a standard for handling forms'

More information

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley PHP and MySQL for Dynamic Web Sites Intro Ed Crowley Class Preparation If you haven t already, download the sample scripts from: http://www.larryullman.com/books/phpand-mysql-for-dynamic-web-sitesvisual-quickpro-guide-4thedition/#downloads

More information

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 11 Introduction to PHP

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 11 Introduction to PHP Chapter 11 Introduction to PHP 11.1 Origin and Uses of PHP Developed by Rasmus Lerdorf in 1994 PHP is a server-side scripting language, embedded in XHTML pages PHP has good support for form processing

More information

Web Scripting using PHP

Web Scripting using PHP Web Scripting using PHP Server side scripting So what is a Server Side Scripting Language? Programming language code embedded into a web page PERL PHP PYTHON ASP Different ways of scripting the Web Programming

More information

Global Servers. The new masters

Global Servers. The new masters Global Servers The new masters Course so far General OS principles processes, threads, memory management OS support for networking Protocol stacks TCP/IP, Novell Netware Socket programming RPC - (NFS),

More information

CSC Web Technologies, Spring Web Data Exchange Formats

CSC Web Technologies, Spring Web Data Exchange Formats CSC 342 - Web Technologies, Spring 2017 Web Data Exchange Formats Web Data Exchange Data exchange is the process of transforming structured data from one format to another to facilitate data sharing between

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

PHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP?

PHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP? PHP 5 Introduction What You Should Already Know you should have a basic understanding of the following: HTML CSS What is PHP? PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open

More information

PHP: The Basics CISC 282. October 18, Approach Thus Far

PHP: The Basics CISC 282. October 18, Approach Thus Far PHP: The Basics CISC 282 October 18, 2017 Approach Thus Far User requests a webpage (.html) Server finds the file(s) and transmits the information Browser receives the information and displays it HTML,

More information

Instructor s Notes Web Data Management Web Client/Server Concepts. Web Data Management Web Client/Server Concepts

Instructor s Notes Web Data Management Web Client/Server Concepts. Web Data Management Web Client/Server Concepts Instructor s Web Data Management Web Client/Server Concepts Web Data Management 152-155 Web Client/Server Concepts Quick Links & Text References Client / Server Concepts Pages 4 11 Web Data Mgt Software

More information

COMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts

COMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts COMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

More information

Programming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur

Programming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur Programming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur Lecture 04 Demonstration 1 So, we have learned about how to run Java programs

More information

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective-

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective- UNIT -II Style Sheets: CSS-Introduction to Cascading Style Sheets-Features- Core Syntax-Style Sheets and HTML Style Rle Cascading and Inheritance-Text Properties-Box Model Normal Flow Box Layout- Beyond

More information

Web Engineering (CC 552)

Web Engineering (CC 552) Web Engineering (CC 552) Introduction Dr. Mohamed Magdy mohamedmagdy@gmail.com Room 405 (CCIT) Course Goals n A general understanding of the fundamentals of the Internet programming n Knowledge and experience

More information

Course Topics. The Three-Tier Architecture. Example 1: Airline reservations. IT360: Applied Database Systems. Introduction to PHP

Course Topics. The Three-Tier Architecture. Example 1: Airline reservations. IT360: Applied Database Systems. Introduction to PHP Course Topics IT360: Applied Database Systems Introduction to PHP Database design Relational model SQL Normalization PHP MySQL Database administration Transaction Processing Data Storage and Indexing The

More information

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It

More information

Starting with a great calculator... Variables. Comments. Topic 5: Introduction to Programming in Matlab CSSE, UWA

Starting with a great calculator... Variables. Comments. Topic 5: Introduction to Programming in Matlab CSSE, UWA Starting with a great calculator... Topic 5: Introduction to Programming in Matlab CSSE, UWA! MATLAB is a high level language that allows you to perform calculations on numbers, or arrays of numbers, in

More information

Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010

Javascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010 Lecture 14 Javascript Announcements Project #2 New website Exam#2 No. Class Date Subject and Handout(s) 17 11/4/10 Examination Review Practice Exam PDF 18 11/9/10 Search, Safety, Security Slides PDF UMass

More information

Managing State. Chapter 13

Managing State. Chapter 13 Managing State Chapter 13 Textbook to be published by Pearson Ed 2015 in early Pearson 2014 Fundamentals of Web http://www.funwebdev.com Development Section 1 of 8 THE PROBLEM OF STATE IN WEB APPLICATIONS

More information

(Frequently Asked Questions)

(Frequently Asked Questions) (Frequently Asked Questions) Aptech Ltd. Version 1.0 Page 1 of 9 Table of Contents S# Question 1. How do you create sub domains using PHP? 2. What is the difference between echo and print statements in

More information

How to work with HTTP requests and responses

How to work with HTTP requests and responses How a web server processes static web pages Chapter 18 How to work with HTTP requests and responses How a web server processes dynamic web pages Slide 1 Slide 2 The components of a servlet/jsp application

More information

CSC Web Programming. Introduction to JavaScript

CSC Web Programming. Introduction to JavaScript CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its

More information

Writing Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p.

Writing Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p. Preface p. xiii Writing Servlets and JSPs p. 1 Writing a Servlet p. 1 Writing a JSP p. 7 Compiling a Servlet p. 10 Packaging Servlets and JSPs p. 11 Creating the Deployment Descriptor p. 14 Deploying Servlets

More information

Static Webpage Development

Static Webpage Development Dear Student, Based upon your enquiry we are pleased to send you the course curriculum for PHP Given below is the brief description for the course you are looking for: - Static Webpage Development Introduction

More information

Using Development Tools to Examine Webpages

Using Development Tools to Examine Webpages Chapter 9 Using Development Tools to Examine Webpages Skills you will learn: For this tutorial, we will use the developer tools in Firefox. However, these are quite similar to the developer tools found

More information

Hello everyone! Page 1. Your folder should look like this. To start with Run your XAMPP app and start your Apache and MySQL.

Hello everyone! Page 1. Your folder should look like this. To start with Run your XAMPP app and start your Apache and MySQL. Hello everyone! Welcome to our PHP + MySQL (Easy to learn) E.T.L. free online course Hope you have installed your XAMPP? And you have created your forms inside the studio file in the htdocs folder using

More information

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Programming the Web 06CS73 INTRODUCTION AND OVERVIEW. Dr. Kavi Mahesh, PESIT, Bangalore. Textbook: Programming the World Wide Web

Programming the Web 06CS73 INTRODUCTION AND OVERVIEW. Dr. Kavi Mahesh, PESIT, Bangalore. Textbook: Programming the World Wide Web Programming the Web 06CS73 INTRODUCTION AND OVERVIEW Dr. Kavi Mahesh, PESIT, Bangalore Textbook: Programming the World Wide Web Introduction: Internet and World-Wide Web Internet History Internet Protocols

More information

PHP + ANGULAR4 CURRICULUM 6 WEEKS

PHP + ANGULAR4 CURRICULUM 6 WEEKS PHP + ANGULAR4 CURRICULUM 6 WEEKS Hands-On Training In this course, you develop PHP scripts to perform a variety to takes, culminating in the development of a full database-driven Web page. Exercises include:

More information

COSC 2206 Internet Tools. The HTTP Protocol

COSC 2206 Internet Tools. The HTTP Protocol COSC 2206 Internet Tools The HTTP Protocol http://www.w3.org/protocols/ What is TCP/IP? TCP: Transmission Control Protocol IP: Internet Protocol These network protocols provide a standard method for sending

More information

CGS 3066: Spring 2015 JavaScript Reference

CGS 3066: Spring 2015 JavaScript Reference CGS 3066: Spring 2015 JavaScript Reference Can also be used as a study guide. Only covers topics discussed in class. 1 Introduction JavaScript is a scripting language produced by Netscape for use within

More information

The role of semantic analysis in a compiler

The role of semantic analysis in a compiler Semantic Analysis Outline The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Functional Programming Languages (FPL)

Functional Programming Languages (FPL) Functional Programming Languages (FPL) 1. Definitions... 2 2. Applications... 2 3. Examples... 3 4. FPL Characteristics:... 3 5. Lambda calculus (LC)... 4 6. Functions in FPLs... 7 7. Modern functional

More information

PHP CURRICULUM 6 WEEKS

PHP CURRICULUM 6 WEEKS PHP CURRICULUM 6 WEEKS Hands-On Training In this course, you develop PHP scripts to perform a variety to takes, culminating in the development of a full database-driven Web page. Exercises include: Accessing

More information

Hypertext Transport Protocol

Hypertext Transport Protocol Hypertext Transport Protocol HTTP Hypertext Transport Protocol Language of the Web protocol used for communication between web browsers and web servers TCP port 80 HTTP - URLs URL Uniform Resource Locator

More information

The PHP language. Teaching you everything about PHP? Not exactly Goal: teach you how to interact with a database via web

The PHP language. Teaching you everything about PHP? Not exactly Goal: teach you how to interact with a database via web Web programming The PHP language Our objective Teaching you everything about PHP? Not exactly Goal: teach you how to interact with a database via web Access data inserted by users into HTML forms Interact

More information

welcome to BOILERCAMP HOW TO WEB DEV

welcome to BOILERCAMP HOW TO WEB DEV welcome to BOILERCAMP HOW TO WEB DEV Introduction / Project Overview The Plan Personal Website/Blog Schedule Introduction / Project Overview HTML / CSS Client-side JavaScript Lunch Node.js / Express.js

More information

Quiz 1 Review Session. November 17th, 2014

Quiz 1 Review Session. November 17th, 2014 Quiz 1 Review Session November 17th, 2014 Topics (non-exhaustive) pointers linked lists hash tables trees tries stacks queues TCP/IP HTTP HTML CSS PHP MVC SQL HTTP statuses DOM JavaScript jquery Ajax security...

More information

BEFORE CLASS. If you haven t already installed the Firebug extension for Firefox, download it now from

BEFORE CLASS. If you haven t already installed the Firebug extension for Firefox, download it now from BEFORE CLASS If you haven t already installed the Firebug extension for Firefox, download it now from http://getfirebug.com. If you don t already have the Firebug extension for Firefox, Safari, or Google

More information

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine

More information

COMP284 Scripting Languages Lecture 11: PHP (Part 3) Handouts

COMP284 Scripting Languages Lecture 11: PHP (Part 3) Handouts COMP284 Scripting Languages Lecture 11: PHP (Part 3) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

More information

JavaScript: Introduction, Types

JavaScript: Introduction, Types JavaScript: Introduction, Types Computer Science and Engineering College of Engineering The Ohio State University Lecture 19 History Developed by Netscape "LiveScript", then renamed "JavaScript" Nothing

More information

RESTful Services. Distributed Enabling Platform

RESTful Services. Distributed Enabling Platform RESTful Services 1 https://dev.twitter.com/docs/api 2 http://developer.linkedin.com/apis 3 http://docs.aws.amazon.com/amazons3/latest/api/apirest.html 4 Web Architectural Components 1. Identification:

More information

Lecture 3: Web Servers / PHP and Apache. CS 383 Web Development II Monday, January 29, 2018

Lecture 3: Web Servers / PHP and Apache. CS 383 Web Development II Monday, January 29, 2018 Lecture 3: Web Servers / PHP and Apache CS 383 Web Development II Monday, January 29, 2018 Server Configuration One of the most common configurations of servers meant for web development is called a LAMP

More information

Session 8. Reading and Reference. en.wikipedia.org/wiki/list_of_http_headers. en.wikipedia.org/wiki/http_status_codes

Session 8. Reading and Reference. en.wikipedia.org/wiki/list_of_http_headers. en.wikipedia.org/wiki/http_status_codes Session 8 Deployment Descriptor 1 Reading Reading and Reference en.wikipedia.org/wiki/http Reference http headers en.wikipedia.org/wiki/list_of_http_headers http status codes en.wikipedia.org/wiki/_status_codes

More information

Distributed Databases and Remote Access to a Database

Distributed Databases and Remote Access to a Database Distributed Databases and Remote Access to a Database Table of Contents 1 Distributed Databases... 2 2 Internet (Overview)... 4 3 Internet-Based Applications... 9 3.1 Server-Side Scripting... 9 3.2 Client-Side

More information

Backend Development. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Backend Development. SWE 432, Fall 2017 Design and Implementation of Software for the Web Backend Development SWE 432, Fall 2017 Design and Implementation of Software for the Web Real World Example https://qz.com/1073221/the-hackers-who-broke-into-equifax-exploited-a-nine-year-old-security-flaw/

More information

Dreamweaver is a full-featured Web application

Dreamweaver is a full-featured Web application Create a Dreamweaver Site Dreamweaver is a full-featured Web application development tool. Dreamweaver s features not only assist you with creating and editing Web pages, but also with managing and maintaining

More information

Such JavaScript Very Wow

Such JavaScript Very Wow Such JavaScript Very Wow Lecture 9 CGS 3066 Fall 2016 October 20, 2016 JavaScript Numbers JavaScript numbers can be written with, or without decimals. Extra large or extra small numbers can be written

More information

Assignment #3 CSCI 201 Spring % of course grade Title Weathermeister Back-End API Integration

Assignment #3 CSCI 201 Spring % of course grade Title Weathermeister Back-End API Integration Assignment #3 CSCI 201 4.5% of course grade Title Weathermeister Back-End API Integration Topics Covered Java Classes HTML CSS Basic Java Topics Java Servlets JSP JavaScript AJAX Databases SQL JDBC Overview

More information

CS 377 Database Systems. Li Xiong Department of Mathematics and Computer Science Emory University

CS 377 Database Systems. Li Xiong Department of Mathematics and Computer Science Emory University CS 377 Database Systems Database Programming in PHP Li Xiong Department of Mathematics and Computer Science Emory University Outline A Simple PHP Example Overview of Basic Features of PHP Overview of PHP

More information

10.1 Overview of Ajax

10.1 Overview of Ajax 10.1 Overview of Ajax - History - Possibility began with the nonstandard iframe element, which appeared in IE4 and Netscape 4 - An iframe element could be made invisible and could be used to send asynchronous

More information

Programming the World Wide Web by Robert W. Sebesta

Programming the World Wide Web by Robert W. Sebesta Programming the World Wide Web by Robert W. Sebesta Tired Of Rpg/400, Jcl And The Like? Heres A Ticket Out Programming the World Wide Web by Robert Sebesta provides students with a comprehensive introduction

More information

B. V. Patel Institute of BMC & IT 2014

B. V. Patel Institute of BMC & IT 2014 Unit 1: Introduction Short Questions: 1. What are the rules for writing PHP code block? 2. Explain comments in your program. What is the purpose of comments in your program. 3. How to declare and use constants

More information

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables

Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

More information

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript

Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

More information

COMP284 Scripting Languages Lecture 9: PHP (Part 1) Handouts

COMP284 Scripting Languages Lecture 9: PHP (Part 1) Handouts COMP284 Scripting Languages Lecture 9: PHP (Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Contents

More information

Databases on the web

Databases on the web Databases on the web The Web Application Stack Network Server You The Web Application Stack Network Server You The Web Application Stack Web Browser Network Server You The Web Application Stack Web Browser

More information

Creating HTML files using Notepad

Creating HTML files using Notepad Reference Materials 3.1 Creating HTML files using Notepad Inside notepad, select the file menu, and then Save As. This will allow you to set the file name, as well as the type of file. Next, select the

More information

Java4340r: Review. R.G. (Dick) Baldwin. 1 Table of Contents. 2 Preface

Java4340r: Review. R.G. (Dick) Baldwin. 1 Table of Contents. 2 Preface OpenStax-CNX module: m48187 1 Java4340r: Review R.G. (Dick) Baldwin This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 4.0 Abstract This module contains review

More information

Web System and Technologies (Objective + Subjective)

Web System and Technologies (Objective + Subjective) 1. What four components are needed to create a fully dynamic web page. A web server (such as Apache), a server-side scripting language (PHP), a database (MySQL), and a client-side scripting language (JavaScript)

More information