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

Similar documents
Course Topics. IT360: Applied Database Systems. Introduction to PHP

Lecture 12. PHP. cp476 PHP

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

A340 Laboratory Session #12

UR what? ! URI: Uniform Resource Identifier. " Uniquely identifies a data entity " Obeys a specific syntax " schemename:specificstuff

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

Shankersinh Vaghela Bapu Institue of Technology

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

Outline of Lecture 5. Course Content. Objectives of Lecture 6 CGI and HTML Forms

PHP CURRICULUM 6 WEEKS

Inf 202 Introduction to Data and Databases (Spring 2010)

1) What is the first step of the system development life cycle (SDLC)? A) Design B) Analysis C) Problem and Opportunity Identification D) Development

Govt. of Karnataka, Department of Technical Education Diploma in Computer Science & Engineering. Fifth Semester. Subject: Web Programming

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

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

Server side basics CS380

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

Programming the World Wide Web by Robert W. Sebesta

Introduction. Server-side Techniques. Introduction. 2 modes in the PHP processor:

Web Engineering (Lecture 08) WAMP

PHP Introduction. Some info on MySQL which we will cover in the next workshop...

Server-side computing

// Introducing PHP. Overview of Dynamic Sites with PHP and Top 5 Best Practices. WebTechNY September 10 th, 2008

Alpha College of Engineering and Technology. Question Bank

Hands-On Perl Scripting and CGI Programming

Databases on the web

PHP + ANGULAR4 CURRICULUM 6 WEEKS

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

Arithmetic and Assignment Operators

CERTIFICATE IN WEB PROGRAMMING

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:

Part I. Web Technologies for Interactive Multimedia

Data Presentation and Markup Languages

PHP. M hiwa ahamad aziz Raparin univercity. 1 Web Design: Lecturer ( m hiwa ahmad aziz)

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Developing Online Databases and Serving Biological Research Data

A QUICK GUIDE TO PROGRAMMING FOR THE WEB. ssh (then type your UBIT password when prompted)

Web Programming/Scripting: PHP and AJAX Refresher

Using htmlarea & a Database to Maintain Content on a Website

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Introduction. This course Software Architecture with Java will discuss the following topics:

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users

Moving on. Code: moving-on

Introduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003

Table of Contents WWW. WWW history (2) WWW history (1) WWW history. Basic concepts. World Wide Web Aka The Internet. Client side.

Writing Perl Programs using Control Structures Worked Examples

PHP 1. Introduction Temasek Polytechnic

CMPS 401 Survey of Programming Languages

DC71 INTERNET APPLICATIONS DEC 2014

By the end of this section of the practical, the students should be able to:

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

Chapter 15 Java Server Pages (JSP)

CPET 581 E-Commerce & Business Technologies. Topics

AIM. 10 September

PHP by Pearson Education, Inc. All Rights Reserved.

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

Notes General. IS 651: Distributed Systems 1

Contents. Acknowledgments

CS6501 IP Unit IV Page 1

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

Programming for the Web with PHP

PHP 5 if...else...elseif Statements

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Software Development & Education Center PHP 5

USQ/CSC2406 Web Publishing

Subject Name: Advanced Web Programming Subject Code: (13MCA43) 1. what is PHP? Discuss different control statements

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

PHP Dynamic Web Pages, Without Knowing Beans

CPSC 481: CREATIVE INQUIRY TO WSBF

How To Redirect A Webpage Cheat Sheet

HTTP. EC512 Spring /15/2015 EC512 - Prof. Thomas Skinner 1

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

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

First Simple Interactive JSP example

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

Course Syllabus. Course Title. Who should attend? Course Description. PHP ( Level 1 (

Session 8. Introduction to Servlets. Semester Project

Ch04 JavaServer Pages (JSP)

Get in Touch Module 1 - Core PHP XHTML

MI1004 Script programming and internet applications

Developing Web Applications

Web Systems & Technologies: An Introduction

Chapter 27. HTTP and WWW

HTML 5 Form Processing

CS144 Notes: Web Standards

TUTORIAL QUESTION BANK

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

Web Programming Paper Solution (Chapter wise)

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

Review. Fundamentals of Website Development. Web Extensions Server side & Where is your JOB? The Department of Computer Science 11/30/2015

Chapter 1. Introduction to web development and PHP. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C1

Simple But Useful Tools for Interactive WWW Development

CORE PHP CURRICULUM. Introductory Session Web Architecture Overview of PHP Platform Origins of PHP in the open source community

Web technologies. Web. basic components. embellishments in browser. DOM (document object model)

Cleveland State University Department of Electrical and Computer Engineering. CIS 408: Internet Computing

Web Engineering (CC 552)

<form>. input elements. </form>

Session 16. JavaScript Part 1. Reading

An Introduction to JavaScript & Bootstrap Basic concept used in responsive website development Form Validation Creating templates

World Wide Web, etc.

Transcription:

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 Three-Tier Architecture Example 1: Airline reservations Presentation tier Client Program (Web Browser) Build a system for making airline reservations Database System Middle tier Application Server Application Server Data management tier Database Management System Client Program 1

Technologies Web Applications Client Program (Web Browser) Application Server HTML, Javascript, XSLT C++, Cookies, XML, XPath, web services, Perl, PHP Need to choose: Operating system Windows or Linux Web server software Apache or IIS Database Management System MySQL Programming or scripting language PHP Database Management System SQL, Triggers, Stored Procedures PHP PHP Strengths PHP: PHP Hypertext Preprocessor Server-side scripting language Browser never sees PHP - only the web server sees it PHP pages require a web server with PHP support Competitors: Perl, ASP.NET, JSP High performance Interface to many different database systems Built-in libraries Ease of learning and use Object-oriented support Portability Open source Free Availability of support 2

PHP References CGI What does it all look like? Online references http://www.php.net Online Tutorial http://www.w3schools.com/php/default.asp PHP and MySQL Web Development by Luke Welling and Laura Thomson IT350 textbook: Internet & WWW How To Program by Deitel, Deitel, and Goldberg IT350 - CGI Script Basics Common Gateway Interface (CGI) Common : Not specific to any operating system or language Output file generated at runtime: 1. When a program executed as a CGI script, standard output is redirected to client Web server 2. Web server then redirects output to client's browser IT350 - How can CGI get data from user? Technique #1: Forms User enters data via a form, submits Form directs results to a CGI program Script receives data in one of two ways: 1. Method = GET 2. Method = POST Use language-specific method to get these inside CGI program Technique #2: URL with parameters <a href=http://www.cs.usna.edu/calendar/view.php?events=seminars> Seminars </a> 3

Form Processing Input Form form.html <?xml version = "1.0" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> <html><head><title>it360 PHP test page</title></head> <body> <h2>survey</h2> <form action="process_name_age_page.php" method="post"> <p><label>enter your name: <input type="text" name="name"/></label></p> <p><label>enter your age: <input type="text" name="age" /></label></p> <p><input type="submit" name = "submit" value = "Submit"/></p> </form> </body> </html> class Page{ //attributes public $content; public $title = "IT360 page"; private $header = "<?xml version = '1.0' <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd'>"; //constructor public function construct(){ //set public attributes public function set($name, $value){ $this->name = $value; //display page public function display(){ echo $header; echo "<head><title> $this->title </title></head>"; echo "<body>"; echo $this->content; echo "</body></html>"; //end class definition page.inc.php Input Form v2 input_page.php require('page.inc.php'); //create a page object $page = new Page(); $page->title = "IT360 input form"; $page->content = '<h2>survey</h2> <form action="process_name_age_page.php" method="post"> <p><label>enter your name: <input type="text" name="name"/></label></p> <p><label>enter your age: <input type="text" name="age" /></label></p> <p><input type="submit" name = "submit" value = "Submit"/></p> </form>'; //display the page to the browser $page->display(); 4

require('page.inc.php'); process_name_age_page.php function save_to_file($text, $filename = "myfile.txt"){ $fp = @fopen($filename, 'a'); if (!$fp){ echo "<p>error: Could not open file $filename. </p>"; return FALSE; else{ fwrite($fp, $text); fclose($fp); return TRUE; /* get the input parameters from the form. */ $name = $_POST['name']; $age = $_POST['age']; //define constants define('year99',99); //create a page object $page = new Page(); $page->title = "IT360 test PHP"; //check input parameters if (empty($name) empty($age)){ $page->content = '<p> Name or age not entered!!</p>'; else{ //output some response to the user $page->content = "<p>welcome $name!<br /> You are $age years old! <br />"; $page->content=$page->content."your age plus ".(YEAR99-$age)." is ".YEAR99. '</p>'; //save information to file save_to_file("$name\t$age\n"); process_name_age_oo.php //display the page to the browser $page->display(); require('page.inc.php'); $page = new Page(); read_name_age_page.php Class Exercise $filename = $_GET['filename']; @ $fp = fopen($filename, 'r'); if (!$fp){ $page->content = "<p>error! Could not open file $filename for reading.</p>"; else{ $page->content= '<p>'; $line = fgets($fp); while(!feof($fp) ){ $page->content = $page->content. $line. '<br />'; $line = fgets($fp); fclose($fp); $page->content = $page->content.'</p>'; Create a PHP script that accepts a parameter called number from the address bar and prints back the English word for the decimal value (assume number is between 1 and 5). Hint: create first a file that looks like this, and read from the file: One Two Three Four Five $page->display(); 5

PHP Summary PHP tags Mixed with HTML tags File extension.php Statements Separated by semicolon if..else.., while, do, for, switch Variables $varname Type determined by content; variables not declared; case sensitive Strings Single quotes literal string Double quotes interpolated string (variables are replaced with their value) Accessing form variables $_POST[ age ], $_GET[ age ] (if method is GET), $_REQUEST[ age ] PHP Summary PHP objects Java-like inheritance public, private, or protected attributes and methods construct(), destruct(), set(), get() PHP functions function myfunction($param1, $param2){ Files resource fopen(string $filename, string $mode) int fwrite(resource $handle, string $sometext) int fclose(resource $handle) string fgets(resource $handle) boolean feof(resource $handle) 6