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

Size: px
Start display at page:

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

Transcription

1 Introduction Server-side Techniques PHP Hypertext Processor A very popular server side language on web Code embedded directly into HTML documents Features Free, open source Platform independent : implementations exist for UNIX, Linux, Windows Support for a large no of databases Excellent integration with Apache, mysql 1 2 Introduction 2 modes in the PHP processor: Copy (HTML) & interpret (PHP) When it finds HTML code in PHP document Copies it to the output file When it finds PHP script Interprets it and sends out HTML codes Output file: HTML codes only 3 4

2 Hello.php First PHP program <html> <head> <title> Hello </title> </head> <body> <?php echo "<h1> Hello from php </h1>"; echo "<p> Today is ". date("d/m/y"). "</p>";?> </body> </html> 5 6 user Request-Response (HTTP) Client (browser) URL: du.hk/hello.php Web Server GET hello.php HTTP/1.1 Host: HTTP/ OK Find hello.php Parse the file Interpret php parts through PHP interpreter Produce HTML codes Client-side vs Server-side DHTML / JavaScript Sent from server to client Runs on the client Client is able to see those JavaScript codes PHP Runs on the server Client can see results only, not the PHP codes 7 8

3 Variables in PHP Variables: Always starts with $ Case-sensitive No need to be declared The type is set every time when it is assigned a value Multitype Can contain different types of data Integer $aninteger = 100; Double $adouble = 18.4; String $astring = Hello World ; php reserved words 9 10 Output 3 ywas to produce output echo echo info printing ; print print ( printing info! ); printf c syntax printf ( printing info! %d, $a); <?php Untyped $first = 10; $second=10.0; $third = "10"; Variables in PHP ==compared value === compared value and type if ($first == 10) print "One"; if ($second==10) print "Two"; if ($third == 10) print "Three"; if ($first === 10) print "Four"; if ($second===10) print "Five"; if ($third === 10) print "Six"; 11?> 12

4 Make a page with display like this: Example 4 <p> Select the month: <select name="month"> <option selected="selected" value=""> Please select </option> <?php for ($i=1; $i<=12; $i++) echo "<option value=\"$i\">$i</option>\n";?> </select> </p> code Parameters Passing Forms <form action= method= > Action: Specifies where the form data will be handled action= file1.php Form data will be sent to file1.php Method: 2 options: GET or POST code 15 16

5 Form Variables Form variables can be extracted from $_GET If the form data is submitted using the GET method url changes, depending on user s input $_POST If the form data is submitted using the POST method Data is sent in the body of the request string 17 Example 6 Examine differences between the GET and the POST methods Code: post Code: get 18 Example 7 <?php $in_fname = $_POST['firstname']; $in_ = $_POST[' ']; $in_color = $_POST['color']; $in_lname = $_POST['lastname']; $in_telno = $_POST['phone']; Modify the previous form to include one more field: telephone no After the user clicks the submit button: with the use if-elseif-else statements, check the following: The entries in First name, Last name, address and tel no: are not empty If either one is empty Display Please fill in all the information The entry in tel no is a numeric number (use is_numeric function) If it is not Display The telephone number is not a number All correct Display your information is now being processed?> <?php?> <?php?> <?php }?> if ( ) { <h3> your telephone number is not a number. Please try again. </h3> <p> <a href="ex5_form.html"> Back </a> </p> } else if ( ) { <h3> Your information is now being processed. </h3> } else { <h3> Please fill in all the information. </h3> <p> <a href="ex5_form.html"> Back </a> </p> Code: post 19 20

6 Example 8 Modify the previous page to include a text area for people to enter any text information. Find out the difference between trim($in_comment) nl2br(trim($in_comment)) $in_comment = $_POST['comment']; $in_comment1 = trim($in_comment); Code: post <textarea name="comment" rows="10" cols="20"> </textarea> solution solution Arrays Arrays: Integer index: 0, 1, 2, $data = array( Year1, Year2, Year3"); Non-integer: $data = array( first => Year1, second => Year2, third => Year3 ); 23 24

7 Accessing Arrays C type: for ($i=0; $i< count($data); $i++) print ("element $i is $data[$i] <br /> "); Other methods: foreach($data2 as $value) print("$value <br />"); foreach($data2 as $key=>$value) print ("$key: $value <br />"); Function Example 10 Code 25 Code 26 Example11 Modify the programs in Example 10 so that the following display is obtained: A border is added to enclose the paragraph (note the spacing) Border color is specified by the user <head> <title> Form data from Post Method </title> <style type="text/css"> </style> <?php function processing($name, $ , $c) { print ("<p > $name, thank you for your message. <br />"); print (" We will "); }?> </head> Code 27 28

8 File Processing PHP: create, read and write files on server Basic types of processing Open a file $fp = fopen( filename.txt, r ); $fp = fopen( filename.txt, w ); Read from a file $data = fgets($file, [int length]) Reads the minimum of (one line or the no of bytes specified by length ) $data = file_get_contents(string $filename) Reads entire file into a string File Processing $fp = fopen(filename, indicator) indicator: r read only (from the beginning) r+ read & write, (from the beginning) w write only (from the beginning) w+ read & write (from the beginning) a write only (at the end) a+ read & write, read at the beginning write at the end File Processing Basic types of processing Write to a file fwrite($fp, $outputstring); fwrite($fp, $outputstring, 5); Write the first five characters only Close the file fclose($fp); Use file_exists(filename) to determine where the file exists feof($fp): detect whether it is eof while(!feof($fp)) { } 31 Example 12 Code: php Code: txt 32

9 Maintaining Connection State Each HTTP request is unrelated to any other (from the point of view of web server) HTTP is stateless Common ways: Encode state information in the next URL to be used by the client State= abc Click the next button, url becomes?state=abc No good to send sensitive data Use cookie Use session What is Cookie? A chunk of text stored on a user s hard disk Give web browser a memory: scripts and server-side programs can use that data in another page Example uses: Store a user name and password Your script can enter these values stored in a cookie directly onto the login page Customize a page Use cookie to store personal settings, such as colors, layout, Track user visits Set up a simple counter that tracks the no of times a user has visited the page Bypass welcome messages, offer bonuses to frequent visitors, Create a shopping cart Use cookies to store the items and quantities ordered by the user What is Cookie? Cookie: site-specific Your scripts can only read the cookies that have been created by pages on your site creates a cookie Cookie is visible to But not, Cookies might be rejected or turned off Cookies are browser-specific, computerspecific What is Cookie? Expiration date: If none given, cookie expires at the end of the session Security boolean Secure; or nothing Secure requires that the cookie should be used only if the connection is secure (e.g., HTTPS) 35 36

10 What is Cookie? Three steps: Server sends cookie to client (response header) What is Cookie? Set-Cookie: session=0x4137f; Expires=Wed, 09 Jun :18:14 GMT Stored by the client-side web browser Client sends via an HTTP request Cookie: session=0x4137fd6a Function: Cookie setcookie ("name", "value"); setcookie ("name", "value, expiration ); Expiration is in seconds 2 days = 60 x 60 x 24 x 2 12 hours = 60 x 60 x 12 Cookie1.php 39 40

11 ReadCookies.php Cookies Cookies must be created before any other HTML is created by the PHP Cookies stored in HTTP header User can disable cookies Intended for infrequent storage of small amounts of data Not intended as a general purpose communication or data-transfer mechanism Limitation: 4 kbytes of data per cookie, 20 cookies per web server Sessions Sessions Alternative to cookies Keep track of the actions of a particular user over the period of time he/she is viewing your site Need: session identify number: a key that ties the user to his data Session variables: $_SESSION array 43 Session Handling: Method 1. Request to a page that starts a session 2. PHP generates a session ID and creates a file that stores the session-related variables 3. PHP: set a cookie to hold the session ID 44

12 Session Handling Specify the function at the top session_start() Initializes a session PHP will Check whether a valid session ID exists If not, PHP creates a new ID Note: PHP will set up a session cookie (PHPSESSID) Session variables: $_SESSION[ thevariable ] =. Example Sessions session_destroy ( ) terminates a session Usually: wait for timeout Unset ($_SESSION[ thevariable ] ) Remove a particular session variable header() Redirection Sends a raw HTTP header header( Location: ); Go to another page Refresh Refresh after a few seconds Header( refresh:5; url=login.html ); 47 48

13 Regular Expression describe patterns within text int preg_match (string pattern, string subject) Similar to the JavaScript s syntax ^: match at the start of a string $: match at the end of a string {n}: matches a pattern that has been repeated exactly n times {n, }: matches a pattern that has been repeated at least n times {n, m}: matches a pattern that has been repeated n to m times (inclusive) Regular Expression Similar to the JavaScript s syntax *: equivalent to {0, } +: equivalent to {1, }?: equivalent to {0,1} (): a group of patterns, e.g., (ab) : or operation, e.g., (a b).: any single character [0-9]: a digit [a-za-z]: a character (upper or lower case) Useful Functions array preg_split (string pattern, string subject) Returns an array containing substrings of subject split along boundaries matched by pattern \s: a single whitespace character preg_split("/[\s,]+/","english, Chinese-traditional, Chinese-Simplified"); php 51 Useful Functions int preg_match (string pattern, string subject) Performs a regular expression match Stops at the first match int preg_match_all (string pattern, string subject, array matches) Returns a count of all matches matches[0]: an array of the full pattern matches php matches[1]: an array of sub-pattern 1 matches preg_match("/web/i", $astring, $match1) preg_match_all("/web/i", $astring, $match2) 52

14 Useful Functions preg_replace ($pattern, $replacement, $astring) Works for string and array preg_replace($pattern, $newpattern, $astring); php Test $string="hello World."; preg_match('/world/', $string) preg_match('/o W/', $string) preg_match('/ow/', $string) preg_match('/o/', $string) $string="hello+world."; preg_match('/o+w/', $string) preg_match('/o\+w/', $string) preg_match('/her/', $string) preg_match('/[her]/', $string) Test $string="yes Yes yes yes YEs YeS"; preg_match('/[yy][ee][ss]/', $string) preg_match('/yes/', $string) preg_match('/yes/i', $string) Data Storage 55 56

15 Introduction Client-side cookies, sessions, HTML5 web storage Cookies: Info sent by a server to a browser, and then sent back by browser on future requests to same site All cookies set by server are sent to server during interaction Can be manipulated (i.e., stored as file on client) Can be persistent (set timeout) Introduction Sessions Stored on server Temporary and not permanent (deleted after user has left the website) HTML5 web storage localstorage, sessionstorage window.sessionstorage Values persist only as long as the window or tab in which they were stored Values are only visible within the window or tab that created them Introduction HTML5 Local storage window.localstorage Values persist beyond window and browser lifetimes Values are shared across every window or tab running at the same origin php 59 60

16 HTML5 session storage HTML5 Web storage Removing data: localstorage.removeitem( no ) Clear all storage data: localstorage.clear() Get the number of pairs stored: localstorage.length php Storage Domains and subdomains have different storage Different sites on same domain have same storage storage HTML5 web storage very much like cookies Differences: Cookies: 4 KB, localstorage: depends on browser (usually in MB) Unlike cookies, sessionstorage and localstorage data are NOT sent to server sessionstorage data confined to browser window that it was created in, lasts until browser is closed localstorage has longer persistent, can last even after browser is closed 63 64

17 Object Concept PHP: Object oriented programming Class: template Objects: instants Basic concept: Encapsulation Private variables var Inheritance (single) extends 65

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

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

PHP INTERVIEW QUESTION-ANSWERS

PHP INTERVIEW QUESTION-ANSWERS 1. What is PHP? PHP (recursive acronym for PHP: Hypertext Preprocessor) is the most widely used open source scripting language, majorly used for web-development and application development and can be embedded

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

Programming for the Web with PHP

Programming for the Web with PHP Aptech Ltd Version 1.0 Page 1 of 11 Table of Contents Aptech Ltd Version 1.0 Page 2 of 11 Abstraction Anonymous Class Apache Arithmetic Operators Array Array Identifier arsort Function Assignment Operators

More information

Database Systems Fundamentals

Database Systems Fundamentals Database Systems Fundamentals Using PHP Language Arman Malekzade Amirkabir University of Technology (Tehran Polytechnic) Notice: The class is held under the supervision of Dr.Shiri github.com/arman-malekzade

More information

WEB APPLICATION ENGINEERING II

WEB APPLICATION ENGINEERING II WEB APPLICATION ENGINEERING II Lecture #5 Umar Ibrahim Enesi Objectives Gain understanding of how Cookies and Sessions Work Understand the limitations of Sessions and Cookies Understand how to handle Session

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

Mobile Site Development

Mobile Site Development Mobile Site Development HTML Basics What is HTML? Editors Elements Block Elements Attributes Make a new line using HTML Headers & Paragraphs Creating hyperlinks Using images Text Formatting Inline styling

More information

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

Subject Name: Advanced Web Programming Subject Code: (13MCA43) 1. what is PHP? Discuss different control statements PES Institute of Technology, Bangalore South Campus (Formerly PES School of Engineering) (Hosur Road, 1KM before Electronic City, Bangalore-560 100) Dept of MCA INTERNAL TEST (SCHEME AND SOLUTION) 2 Subject

More information

Multimedia im Netz Online Multimedia Winter semester 2015/16. Tutorial 03 Minor Subject

Multimedia im Netz Online Multimedia Winter semester 2015/16. Tutorial 03 Minor Subject Multimedia im Netz Online Multimedia Winter semester 2015/16 Tutorial 03 Minor Subject Ludwig- Maximilians- Universität München Online Multimedia WS 2015/16 - Tutorial 03-1 Today s Agenda Quick test Server

More information

You can also set the expiration time of the cookie in another way. It may be easier than using seconds.

You can also set the expiration time of the cookie in another way. It may be easier than using seconds. What is a Cookie? A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will

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

Fachgebiet Technische Informatik, Joachim Zumbrägel

Fachgebiet Technische Informatik, Joachim Zumbrägel Computer Network Lab 2017 Fachgebiet Technische Informatik, Joachim Zumbrägel Overview Internet Internet Protocols Fundamentals about HTTP Communication HTTP-Server, mode of operation Static/Dynamic Webpages

More information

Tizen Ver2.2 - HTML5 Web Storage

Tizen Ver2.2 - HTML5 Web Storage Tizen Ver2.2 - HTML5 Web Storage 2014. 12. 01 Contents Web Storage API local storage session storage Tutorial demo code analysis Web Storage Session Storage, Local Storage Web Storage Tizen supports the

More information

Lecture 7: Dates/Times & Sessions. CS 383 Web Development II Wednesday, February 14, 2018

Lecture 7: Dates/Times & Sessions. CS 383 Web Development II Wednesday, February 14, 2018 Lecture 7: Dates/Times & Sessions CS 383 Web Development II Wednesday, February 14, 2018 Date/Time When working in PHP, date is primarily tracked as a UNIX timestamp, the number of seconds that have elapsed

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

Chapter 9. Managing State Information. Understanding State Information (continued) Understanding State Information 10/29/2011.

Chapter 9. Managing State Information. Understanding State Information (continued) Understanding State Information 10/29/2011. Chapter 9 Managing State Information PHP Programming with MySQL 2 nd Edition Objectives In this chapter, you will: Learn about state information Use hidden form fields to save state information Use query

More information

PIC 40A. Lecture 19: PHP Form handling, session variables and regular expressions. Copyright 2011 Jukka Virtanen UCLA 1 05/25/12

PIC 40A. Lecture 19: PHP Form handling, session variables and regular expressions. Copyright 2011 Jukka Virtanen UCLA 1 05/25/12 PIC 40A Lecture 19: PHP Form handling, session variables and regular expressions 05/25/12 Copyright 2011 Jukka Virtanen UCLA 1 How does a browser communicate with a program on a server? By submitting an

More information

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

Persistence. SWE 432, Fall 2017 Design and Implementation of Software for the Web Persistence SWE 432, Fall 2017 Design and Implementation of Software for the Web Today Demo: Promises and Timers What is state in a web application? How do we store it, and how do we choose where to store

More information

CERTIFICATE IN WEB PROGRAMMING

CERTIFICATE IN WEB PROGRAMMING COURSE DURATION: 6 MONTHS CONTENTS : CERTIFICATE IN WEB PROGRAMMING 1. PROGRAMMING IN C and C++ Language 2. HTML/CSS and JavaScript 3. PHP and MySQL 4. Project on Development of Web Application 1. PROGRAMMING

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

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

Course Topics. IT360: Applied Database Systems. Introduction to PHP IT360: Applied Database Systems Introduction to PHP Chapter 1 and Chapter 6 in "PHP and MySQL Web Development" Course Topics Relational model SQL Database design Normalization PHP MySQL Database administration

More information

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

Course Syllabus. Course Title. Who should attend? Course Description. PHP ( Level 1 ( Course Title PHP ( Level 1 ( Course Description PHP '' Hypertext Preprocessor" is the most famous server-side programming language in the world. It is used to create a dynamic website and it supports many

More information

Persistence & State. SWE 432, Fall 2016 Design and Implementation of Software for the Web

Persistence & State. SWE 432, Fall 2016 Design and Implementation of Software for the Web Persistence & State SWE 432, Fall 2016 Design and Implementation of Software for the Web Today What s state for our web apps? How do we store it, where do we store it, and why there? For further reading:

More information

5/19/2015. Objectives. JavaScript, Sixth Edition. Saving State Information with Query Strings. Understanding State Information

5/19/2015. Objectives. JavaScript, Sixth Edition. Saving State Information with Query Strings. Understanding State Information Objectives JavaScript, Sixth Edition When you complete this chapter, you will be able to: Save state information with query strings, hidden form fields, and cookies Describe JavaScript security issues

More information

Autopopulation; Session & Cookies

Autopopulation; Session & Cookies ; Session & Cookies CGT 356 Web Programming, Development, & Database Integration Lecture 5 Session array Use the Session array to store data that needs to be recalled on later pages $_SESSION[ foo ] Use

More information

Web Programming 4) PHP and the Web

Web Programming 4) PHP and the Web Web Programming 4) PHP and the Web Emmanuel Benoist Fall Term 2013-14 Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 1 PHP a language for Web applications Presentation

More information

PHP with data handling

PHP with data handling 171 Lesson 18 PHP with data handling Aim Objectives : To provide an introduction data handling with PHP : To give an idea about, What type of data you need to handle? How PHP handle the form data? 18.1

More information

How browsers talk to servers. What does this do?

How browsers talk to servers. What does this do? HTTP HEADERS How browsers talk to servers This is more of an outline than a tutorial. I wanted to give our web team a quick overview of what headers are and what they mean for client-server communication.

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

CITS1231 Web Technologies. PHP s, Cookies and Session Control

CITS1231 Web Technologies. PHP  s, Cookies and Session Control CITS1231 Web Technologies PHP Emails, Cookies and Session Control Sending email with PHP We have looked at storing user information using files. Email messages can also be thought of as data streams, providing

More information

Lecture 7b: HTTP. Feb. 24, Internet and Intranet Protocols and Applications

Lecture 7b: HTTP. Feb. 24, Internet and Intranet Protocols and Applications Internet and Intranet Protocols and Applications Lecture 7b: HTTP Feb. 24, 2004 Arthur Goldberg Computer Science Department New York University artg@cs.nyu.edu WWW - HTTP/1.1 Web s application layer protocol

More information

Computer Networks. Wenzhong Li. Nanjing University

Computer Networks. Wenzhong Li. Nanjing University Computer Networks Wenzhong Li Nanjing University 1 Chapter 8. Internet Applications Internet Applications Overview Domain Name Service (DNS) Electronic Mail File Transfer Protocol (FTP) WWW and HTTP Content

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

(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

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

DATABASE SYSTEMS. Introduction to web programming. Database Systems Course, 2016 DATABASE SYSTEMS Introduction to web programming Database Systems Course, 2016 AGENDA FOR TODAY Client side programming HTML CSS Javascript Server side programming: PHP Installing a local web-server Basic

More information

CSE 154 LECTURE 21: COOKIES

CSE 154 LECTURE 21: COOKIES CSE 154 LECTURE 21: COOKIES Regular expressions in (PDF) regex syntax: strings that begin and end with /, such as "/[AEIOU]+/" function preg_match(regex, string) preg_replace(regex, replacement, string)

More information

CSE 154 LECTURE 21: COOKIES

CSE 154 LECTURE 21: COOKIES CSE 154 LECTURE 21: COOKIES Regular expressions in (PDF) regex syntax: strings that begin and end with /, such as "/[AEIOU]+/" function preg_match(regex, string) preg_replace(regex, replacement, string)

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

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

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

Sessions. Mendel Rosenblum. CS142 Lecture Notes - Sessions

Sessions. Mendel Rosenblum. CS142 Lecture Notes - Sessions Sessions Mendel Rosenblum How do we know what user sent request? Would like to authenticate user and have that information available each time we process a request. More generally web apps would like to

More information

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 INFORMATION TECHNOLOGY TUTORIAL QUESTION BANK Course Name Course Code Class Branch : Web Technologies : ACS006 : B. Tech

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

GET /index.php HTTP/1.1 Host: User- agent: Mozilla/4.0

GET /index.php HTTP/1.1 Host:   User- agent: Mozilla/4.0 State management GET /index.php HTTP/1.1 Host: www.mtech.edu User- agent: Mozilla/4.0 HTTP/1.1 200 OK Date: Thu, 17 Nov 2011 15:54:10 GMT Server: Apache/2.2.16 (Debian) Content- Length: 285 Set- Cookie:

More information

Lecture 9a: Sessions and Cookies

Lecture 9a: Sessions and Cookies CS 655 / 441 Fall 2007 Lecture 9a: Sessions and Cookies 1 Review: Structure of a Web Application On every interchange between client and server, server must: Parse request. Look up session state and global

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

MCIS/UA. String Literals. String Literals. Here Documents The <<< operator (also known as heredoc) can be used to construct multi-line strings.

MCIS/UA. String Literals. String Literals. Here Documents The <<< operator (also known as heredoc) can be used to construct multi-line strings. MCIS/UA PHP Training 2003 Chapter 6 Strings String Literals Single-quoted strings Double-quoted strings escape sequences String Literals Single-quoted \' - single quote \\ - backslash Interpreted items

More information

INTERNET ENGINEERING. HTTP Protocol. Sadegh Aliakbary

INTERNET ENGINEERING. HTTP Protocol. Sadegh Aliakbary INTERNET ENGINEERING HTTP Protocol Sadegh Aliakbary Agenda HTTP Protocol HTTP Methods HTTP Request and Response State in HTTP Internet Engineering 2 HTTP HTTP Hyper-Text Transfer Protocol (HTTP) The fundamental

More information

COMP519 Web Programming Lecture 28: PHP (Part 4) Handouts

COMP519 Web Programming Lecture 28: PHP (Part 4) Handouts COMP519 Web Programming Lecture 28: PHP (Part 4) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Contents

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

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

An Introduction to JavaScript & Bootstrap Basic concept used in responsive website development Form Validation Creating templates PHP Course Contents An Introduction to HTML & CSS Basic Html concept used in website development Creating templates An Introduction to JavaScript & Bootstrap Basic concept used in responsive website development

More information

Web, HTTP and Web Caching

Web, HTTP and Web Caching Web, HTTP and Web Caching 1 HTTP overview HTTP: hypertext transfer protocol Web s application layer protocol client/ model client: browser that requests, receives, displays Web objects : Web sends objects

More information

Server-side computing

Server-side computing Server-side computing Why server-side? Approaches 1 Why server-side? Markup languages cannot Specify Computations Interactions with users Provide access to Server-side resources Databases Programs Services

More information

Unit 4 The Web. Computer Concepts Unit Contents. 4 Web Overview. 4 Section A: Web Basics. 4 Evolution

Unit 4 The Web. Computer Concepts Unit Contents. 4 Web Overview. 4 Section A: Web Basics. 4 Evolution Unit 4 The Web Computer Concepts 2016 ENHANCED EDITION 4 Unit Contents Section A: Web Basics Section B: Browsers Section C: HTML Section D: HTTP Section E: Search Engines 2 4 Section A: Web Basics 4 Web

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

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

magento_1:full_page_cache https://amasty.com/docs/doku.php?id=magento_1:full_page_cache

magento_1:full_page_cache https://amasty.com/docs/doku.php?id=magento_1:full_page_cache magento_1:full_page_cache https://amasty.com/docs/doku.php?id=magento_1:full_page_cache For more details see the extension page. Speed up your Magento using cache to the full. Decrease pages time load

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

Dreamweaver MX The Basics

Dreamweaver MX The Basics Chapter 1 Dreamweaver MX 2004 - The Basics COPYRIGHTED MATERIAL Welcome to Dreamweaver MX 2004! Dreamweaver is a powerful Web page creation program created by Macromedia. It s included in the Macromedia

More information

Excerpts of Web Application Security focusing on Data Validation. adapted for F.I.S.T. 2004, Frankfurt

Excerpts of Web Application Security focusing on Data Validation. adapted for F.I.S.T. 2004, Frankfurt Excerpts of Web Application Security focusing on Data Validation adapted for F.I.S.T. 2004, Frankfurt by fs Purpose of this course: 1. Relate to WA s and get a basic understanding of them 2. Understand

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

Mount Saint Mary College, Newburgh, NY Internet Programming III - CIT310

Mount Saint Mary College, Newburgh, NY Internet Programming III - CIT310 Warm up mini-lab Lab 1 - Functions Type in the following function definition and calls to the function. Test it and understand it. function myprint($str= No String Supplied ) // the argument is optional

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

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

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

Alpha College of Engineering and Technology. Question Bank

Alpha College of Engineering and Technology. Question Bank Alpha College of Engineering and Technology Department of Information Technology and Computer Engineering Chapter 1 WEB Technology (2160708) Question Bank 1. Give the full name of the following acronyms.

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

Get in Touch Module 1 - Core PHP XHTML

Get in Touch Module 1 - Core PHP XHTML PHP/MYSQL (Basic + Advanced) Web Technologies Module 1 - Core PHP XHTML What is HTML? Use of HTML. Difference between HTML, XHTML and DHTML. Basic HTML tags. Creating Forms with HTML. Understanding Web

More information

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

Web development using PHP & MySQL with HTML5, CSS, JavaScript Web development using PHP & MySQL with HTML5, CSS, JavaScript Static Webpage Development Introduction to web Browser Website Webpage Content of webpage Static vs dynamic webpage Technologies to create

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

John Valance JValance Consulting

John Valance JValance Consulting John Valance JValance Consulting jvalance@sprynet.com Copyright 2011-2012: John Valance Independent consultant o Specialty is helping iseries shops develop web applications, and related skills o Training,

More information

DevShala Technologies A-51, Sector 64 Noida, Uttar Pradesh PIN Contact us

DevShala Technologies A-51, Sector 64 Noida, Uttar Pradesh PIN Contact us INTRODUCING PHP The origin of PHP PHP for Web Development & Web Applications PHP History Features of PHP How PHP works with the Web Server What is SERVER & how it works What is ZEND Engine Work of ZEND

More information

USQ/CSC2406 Web Publishing

USQ/CSC2406 Web Publishing USQ/CSC2406 Web Publishing Lecture 4: HTML Forms, Server & CGI Scripts Tralvex (Rex) Yeap 19 December 2002 Outline Quick Review on Lecture 3 Topic 7: HTML Forms Topic 8: Server & CGI Scripts Class Activity

More information

Document Management System GUI. v6.0 User Guide

Document Management System GUI. v6.0 User Guide Document Management System GUI v6.0 User Guide Copyright Copyright HelpSystems, LLC. All rights reserved. www.helpsystems.com US: +1 952-933-0609 Outside the U.S.: +44 (0) 870 120 3148 IBM, AS/400, OS/400,

More information

magento_1:full_page_cache

magento_1:full_page_cache magento_1:full_page_cache https://amasty.com/docs/doku.php?id=magento_1:full_page_cache For more details see the extension page. Speed up your Magento using cache to the full. Decrease pages time load

More information

WEB TECHNOLOGIES CHAPTER 1

WEB TECHNOLOGIES CHAPTER 1 WEB TECHNOLOGIES CHAPTER 1 WEB ESSENTIALS: CLIENTS, SERVERS, AND COMMUNICATION Modified by Ahmed Sallam Based on original slides by Jeffrey C. Jackson THE INTERNET Technical origin: ARPANET (late 1960

More information

Migration Tool. User Guide. SHOPIFY to MAGENTO. Copyright 2014 LitExtension.com. All Rights Reserved.

Migration Tool. User Guide. SHOPIFY to MAGENTO. Copyright 2014 LitExtension.com. All Rights Reserved. SHOPIFY to MAGENTO Migration Tool User Guide Copyright 2014 LitExtension.com. All Rights Reserved. Shopify to Magento Migration Tool: User Guide Page 1 Contents 1. Preparation... 3 2. Set-up... 3 3. Set-up...

More information

Web Programming with PHP

Web Programming with PHP We know that we can use HTML to build websites, but websites built using pure HTML suffer from a serious limitation. Imagine we want to create a website that displays the current time in Cambridge, MA,

More information

CPET 499/ITC 250 Web Systems. Topics

CPET 499/ITC 250 Web Systems. Topics CPET 499/ITC 250 Web Systems Chapter 13 Managing State Text Book: * Fundamentals of Web Development, 2015, by Randy Connolly and Ricardo Hoar, published by Pearson Paul I-Hai, Professor http://www.etcs.ipfw.edu/~lin

More information

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang WEB SECURITY WORKSHOP TEXSAW 2014 Presented by Solomon Boyd and Jiayang Wang Introduction and Background Targets Web Applications Web Pages Databases Goals Steal data Gain access to system Bypass authentication

More information

WEB APPLICATION ENGINEERING II

WEB APPLICATION ENGINEERING II WEB APPLICATION ENGINEERING II Lecture #4 Umar Ibrahim Enesi Objectives Gain understanding on: Form structure Form Handling Form Validation with Filters and Pattern matching Redirection Sticky form 06-Nov-16

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

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

RKN 2015 Application Layer Short Summary

RKN 2015 Application Layer Short Summary RKN 2015 Application Layer Short Summary HTTP standard version now: 1.1 (former 1.0 HTTP /2.0 in draft form, already used HTTP Requests Headers and body counterpart: answer Safe methods (requests): GET,

More information

CSE 154 LECTURE 13: SESSIONS

CSE 154 LECTURE 13: SESSIONS CSE 154 LECTURE 13: SESSIONS Expiration / persistent cookies setcookie("name", "value", expiration); $expiretime = time() + 60*60*24*7; # 1 week from now setcookie("couponnumber", "389752", $expiretime);

More information

Core PHP. PHP output mechanism. Introducing. Language basics. Installing & Configuring PHP. Introducing of PHP keywords. Operators & expressions

Core PHP. PHP output mechanism. Introducing. Language basics. Installing & Configuring PHP. Introducing of PHP keywords. Operators & expressions Core PHP Introducing The origin of PHP PHP for web Development & Web Application PHP History Features of PHP How PHP works with the server What is server & how it works Installing & Configuring PHP PHP

More information

HTTP Reading: Section and COS 461: Computer Networks Spring 2013

HTTP Reading: Section and COS 461: Computer Networks Spring 2013 HTTP Reading: Section 9.1.2 and 9.4.3 COS 461: Computer Networks Spring 2013 1 Recap: Client-Server Communication Client sometimes on Initiates a request to the server when interested E.g., Web browser

More information

COMS 469: Interactive Media II

COMS 469: Interactive Media II COMS 469: Interactive Media II Agenda Review Ch. 8: Windows and Frames (pp. 263-299) Ch. 11: Storing Info: Cookies (pp. 367-389) Review HTML Forms String Manipulation Objects document.myform document.forms[0]

More information

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

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

HTML5 - INTERVIEW QUESTIONS

HTML5 - INTERVIEW QUESTIONS HTML5 - INTERVIEW QUESTIONS http://www.tutorialspoint.com/html5/html5_interview_questions.htm Copyright tutorialspoint.com Dear readers, these HTML5 Interview Questions have been designed specially to

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

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

Web Programming TL 9. Tutorial. Exercise 1: String Manipulation

Web Programming TL 9. Tutorial. Exercise 1: String Manipulation Exercise 1: String Manipulation Tutorial 1) Which statements print the same thing to the screen and why? echo "$var"; value of $var echo '$var'; the text '$var' echo $var ; value of $var 2) What is printed

More information

PHP State Maintenance (Cookies, Sessions, Hidden Inputs)

PHP State Maintenance (Cookies, Sessions, Hidden Inputs) PHP State Maintenance (Cookies, Sessions, Hidden Inputs) What is meant by state? The Hypertext Transfer Protocol (HTTP) is stateless. This means that each time a browser requests a page, a connection from

More information

ONCONTACT MARKETING AND CAMPAIGN USER GUIDE V10

ONCONTACT MARKETING AND CAMPAIGN USER GUIDE V10 ONCONTACT MARKETING AND CAMPAIGN USER GUIDE V10 Contents Marketing Dashboard... 2 Marketing Dashboard Badges... 2 Marketing Dashboard Panels... 3 Campaign Record... 3 Field Descriptions... 4 Opportunities

More information

This FAQ is only applicable for hostings ordered after 23/6/2010

This FAQ is only applicable for hostings ordered after 23/6/2010 Webhosting FAQ This FAQ is only applicable for hostings ordered after 23/6/2010 1. How do I access my Webhosting control panel?... 1 2. On which server is my hosting set up (IP)?... 4 3. How do I install

More information

About the Authors. Who Should Read This Book. How This Book Is Organized

About the Authors. Who Should Read This Book. How This Book Is Organized Acknowledgments p. XXIII About the Authors p. xxiv Introduction p. XXV Who Should Read This Book p. xxvii Volume 2 p. xxvii Distinctive Features p. xxviii How This Book Is Organized p. xxx Conventions

More information