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

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

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

PHP 1. Introduction Temasek Polytechnic

Lecture 12. PHP. cp476 PHP

PHP. Interactive Web Systems

Unit IV- Server Side Technologies (PHP)

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

Web Engineering (Lecture 08) WAMP

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

Programming the World Wide Web by Robert W. Sebesta

Server side basics CS380

Your Secrets to Coding Fast

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

Databases on the web

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

Creating HTML files using Notepad

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:

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

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

php Mr. Amit Patel Hypertext Preprocessor Dept. of I.T.

Lecture 7 PHP Basics. Web Engineering CC 552

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

Part I. Web Technologies for Interactive Multimedia

INTERNET PROGRAMMING XML

Upload to your web space (e.g., UCSC) Due this Thursday 4/8 in class Deliverable: Send me an with the URL Grading:

CPET 581 E-Commerce & Business Technologies. Topics

UNIT I Java Bean, HTML & Javascript

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

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Programming for the Web with PHP

Planning and Designing Your Site p. 109 Design Concepts p. 116 Summary p. 118 Defining Your Site p. 119 The Files Panel p. 119 Accessing Your Remote

Lecture : 3. Practical : 2. Course Credit. Tutorial : 0. Total : 5. Course Learning Outcomes

LSD APC Part I Workshop Geographic Information System. Danny Yeung 6 May 2017

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

Basic PHP. Lecture 19. Robb T. Koether. Hampden-Sydney College. Mon, Feb 26, 2108

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

PHP Online Training. PHP Online TrainingCourse Duration - 45 Days. Call us: HTML

DC71 INTERNET APPLICATIONS JUNE 2013

Introduction to Databases. Key Concepts. Calling a PHP Script 5/17/2012 PHP I

- Origins - Rasmus Lerdorf Developed to allow him to track visitors to his Web site

Shankersinh Vaghela Bapu Institue of Technology

Server side basics CSC 210

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

Discovering Computers Chapter 13 Programming Languages and Program Development

Basic PHP Lecture 17

World Wide Web PROGRAMMING THE PEARSON EIGHTH EDITION. University of Colorado at Colorado Springs

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

Lecture 20. Introduction to PHP (Part-2) Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

welcome to BOILERCAMP HOW TO WEB DEV

Start of the site or web application development

Web Scripting using PHP

Alpha College of Engineering and Technology. Question Bank

Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실

Setting Up a Development Server What Is a WAMP, MAMP, or LAMP? Installing a WAMP on Windows Testing the InstallationAlternative WAMPs Installing a

CSC Web Programming. Introduction to JavaScript

Time: 3 hours. Full Marks: 70. The figures in the margin indicate full marks. Answer from all the Groups as directed. Group A.

- Origins - Rasmus Lerdorf Developed to allow him to track visitors to his Web site

13. Databases on the Web

Notes General. IS 651: Distributed Systems 1

PHP & My SQL Duration-4-6 Months

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

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

ICOM 5016 Database Systems. Database Users. User Interfaces and Tools. Chapter 8: Application Design and Development.

WebDev. Web Design COMBINES A NUMBER OF DISCIPLINES. Web Development Process DESIGN DEVELOPMENT CONTENT MULTIMEDIA

Part 3: Online Social Networks

PHP Hypertext Preprocessor

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

Important Points about PHP:

20. Web Hosting 웹프로그래밍 2016 년 1 학기 충남대학교컴퓨터공학과

CERTIFICATE IN WEB PROGRAMMING

Lecture 2 Unix and PHP. INLS 523 Web Databases Spring 2013 Rob Capra

is Introduction to HTML

A Web-Based Introduction

CGS 3066: Spring 2015 JavaScript Reference

Agenda. INTRODUCTION TO WEB DEVELOPMENT AND HTML <Lecture 1> 1/20/2013. What is a Web Developer? Rommel Anthony Palomino Spring

What is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script

UFCEKG Lecture 4 Server Side Scripting & PHP

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Networking & The Web. HCID 520 User Interface Software & Technology

JavaScript: Introduction, Types

DATABASE SYSTEMS. Introduction to web programming. Database Systems Course, 2016

PHP by Pearson Education, Inc. All Rights Reserved.

Introduction of PHP Created By: Umar Farooque Khan

C++ Programming Lecture 7 Control Structure I (Repetition) Part I

Web Scripting using PHP

Manju Muralidharan Priya. CS4PM Web Aesthetics and Development WEEK 12

Front End Programming

Modern Web Application Development. Sam Hogarth

COMP284 Scripting Languages Lecture 15: JavaScript (Part 2) Handouts

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.

SSC - Web applications and development Introduction and Java Servlet (I)

Babu Madhav Institute of Information Technology, UTU 2017

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

Web Programming Paper Solution (Chapter wise)

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Networking & The Web. HCID 520 User Interface Software & Technology

Chapter 11 Program Development and Programming Languages

Ch04 JavaServer Pages (JSP)


Web development using PHP & MySQL with HTML5, CSS, JavaScript

Transcription:

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 CGI, PHP ASP Perl JSP Java Servlets network Protocols Application client-side programming HTML CSS JavaScript (AJAX) XML 3

COMMON GATEWAY INTERFACE (CGI) CGI was the first server-side processing solution. Problem: CGI program for example acts as a gateway to a database, a new DB connection has to be established for each request which results in a very poor performance. 4

JAVA SERVLETS A Java servlet is a Java class that has to extend the abstract HTTPServlet class. The Java servlet class is loaded by a servlet container and relevant requests (based on a servlet binding) are forwarded to the servlet instance for further processing. 5

JAVA SERVLETS Problem: (e.g. HTML) has to be defined within the servlet, not easy to share tasks between web designer and programmer. 6

JAVASERVER PAGES (JSP) JavaServer Pages (JSP) is a technology that helps software developers create dynamically generated web pages based on HTML, XML, or other document types. Released in 1999 by Sun Microsystems, JSP is similar to PHP, but it uses the Java programming language. 7

HYPERTEXT PREPROCESSOR (PHP) PHP is a server-side scripting language designed for web development but also used as a generalpurpose programming language. 8

HYPERTEXT PREPROCESSOR (PHP) 9

SERVER-SIDE SCRIPTING LANGUAGES There are a number of server-side scripting languages available, including: 1. ASP (*.asp) 2. ActiveVFP (*.avfp) 3. ASP.NET (*.aspx) 4. C (*.c, *.csp) via CGI 5. ColdFusion Markup Language (*.cfm) 6. Go (*.go) 7. Groovy Server Pages (*.gsp) 8. Java (*.jsp) via JavaServer Pages 9. JavaScript using Server-side JavaScript (*.ssjs, *.js) (example: Node.js) 10. Lua (*.lp *.op *.lua) 11. Perl via the CGI.pm module (*.cgi, *.ipl, *.pl) 12. PHP (*.php) 13. R (*.rhtml) - (example: rapache) 14. Python (*.py) (examples: Pyramid, Flask, Django) 15. Ruby (*.rb, *.rbw) (example: Ruby on Rails) 16. SMX (*.smx) 17. Lasso (*.lasso) 18. Tcl (*.tcl) 19. WebDNA (*.dna,*.tpl) 20. Progress WebSpeed (*.r,*.w) 10

HTML, CSS, JAVASCRIPT, XML & PHP DOCUMENTS HTML to define the content of web pages. CSS to specify the layout of web pages. JavaScript to program the behavior of web pages. AJAX to update parts of a web page, without reloading whole page. XML to carry data. PHP to execute on the server. 11

WHAT IS PHP? 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. PHP files can contain text, HTML, CSS, JavaScript, and PHP code. PHP code are executed on the server, and the result is returned to the browser as plain HTML. PHP files have extension ".php. 12

WHAT CAN PHP DO? PHP can generate dynamic page content. PHP can create, open, read, write, delete, and close files on the server. PHP can collect form data. PHP can send and receive cookies. PHP can add, delete, modify data in your database. PHP can be used to control user-access. PHP can encrypt data. 13

PHP SYNTAX <html> <body> <h1>my first PHP page</h1> <?php echo "Hello World!";?> </body> </html> 14

COMMENTS IN PHP <html> <body> <?php // This is a single-line comment # This is also a single-line comment /* This is a multiple-lines comment block that spans over multiple lines */?> </body> </html> 15

PHP NOT CASE-SENSITIVE <html> <body> <?php ECHO "Hello World!<br>"; echo "Hello World!<br>"; EcHo "Hello World!<br>";?> </body> </html> 16

PHP VARIABLE ARE CASE-SENSITIVE <html> <body> <?php $color = "red"; echo "My car is ". $color. "<br>"; echo "My house is ". $COLOR. "<br>"; echo "My boat is ". $color. "<br>";?> </body> </html> 17

PHP DATA TYPES PHP supports the following data types: 1. String 2. Integer 3. Float (floating point numbers - also called double) 4. Boolean 5. Array 6. Object 7. NULL 8. Resource 18

DECLARING PHP VARIABLES <html> <body> <?php $txt = "Hello world!"; $x = 5; $y = 10.5; echo $txt; echo "<br>"; echo $x; echo "<br>"; echo $y;?> </body> </html> 19

PHP OPERATORS PHP divides the operators in the following groups: 1. Arithmetic operators 2. Assignment operators 3. Comparison operators 4. Increment/Decrement operators 5. Logical operators 6. String operators 7. Array operators 20

PHP ARITHMETIC OPERATORS 21

PHP ASSIGNMENT OPERATORS 22

PHP COMPARISON OPERATORS 23

PHP INCREMENT / DECREMENT OPERATORS 24

PHP LOGICAL OPERATORS 25

PHP STRING OPERATORS 26

PHP ARRAY OPERATORS 27

PHP CONDITIONAL STATEMENTS In PHP we have the following conditional statements: 1. if statement - executes some code only if a specified condition is true 2. if...else statement - executes some code if a condition is true and another code if the condition is false 3. if...else if...else statement - specifies a new condition to test, if the first condition is false 4. switch statement - selects one of many blocks of code to be executed 28

PHP CONDITIONAL STATEMENTS <html> <body> <?php $t = date("h"); echo "<p>the hour (of the server) is ". $t; echo ", and will give the following message:</p>"; if ($t < "10") { echo "Have a good morning!"; } elseif ($t < "20") { echo "Have a good day!"; } else { echo "Have a good night!"; }?> </body> </html> 29

PHP CONDITIONAL STATEMENTS <html> <body> <?php $favcolor = "red"; switch ($favcolor) { case "red": echo "Your favorite color is red!"; break; case "blue": echo "Your favorite color is blue!"; break; case "green": echo "Your favorite color is green!"; break; default: echo "Your favorite color is neither red, blue, or green!"; }?> </body> </html> 30

PHP LOOPS In PHP, we have the following looping statements: 1. while - loops through a block of code as long as the specified condition is true 2. do...while - loops through a block of code once, and then repeats the loop as long as the specified condition is true 3. for - loops through a block of code a specified number of times 4. foreach - loops through a block of code for each element in an array 31

PHP FUNCTIONS <html> <body> Hege Refsnes. Born in 1975 Stale Refsnes. Born in 1978 Kai Jim Refsnes. Born in 1983 <?php function familyname($fname, $year) { echo "$fname Refsnes. Born in $year <br>"; } familyname("hege","1975"); familyname("stale","1978"); familyname("kai Jim","1983");?> </body> </html> 32

PHP FUNCTIONS <html> <body> 5 + 10 = 15 7 + 13 = 20 2 + 4 = 6 <?php function sum($x, $y) { $z = $x + $y; return $z; } echo "5 + 10 = ". sum(5,10). "<br>"; echo "7 + 13 = ". sum(7,13). "<br>"; echo "2 + 4 = ". sum(2,4);?> </body> </html> 33

PHP ARRAYS <html> <body> <?php $cars = array("volvo", "BMW", "Toyota"); $arrlength = count($cars); for($x = 0; $x < $arrlength; $x++) { }?> echo $cars[$x]; echo "<br>"; </body> </html> 34

PHP SORTING ARRAYS we will go through the following PHP array sort functions: 1. sort() - sort arrays in ascending order 2. rsort() - sort arrays in descending order 3. asort() - sort associative arrays in ascending order, according to the value 4. ksort() - sort associative arrays in ascending order, according to the key 5. arsort() - sort associative arrays in descending order, according to the value 6. krsort() - sort associative arrays in descending order, according to the key 35

PHP SORTING ARRAYS <html> <body> <?php $numbers = array(4, 6, 2, 22, 11); sort($numbers); 2 4 6 11 22 $arrlength = count($numbers); for($x = 0; $x < $arrlength; $x++) { echo $numbers[$x]; echo "<br>"; }?> </body> </html> 36

REFERENCES 37

Next Lecture PHP 38