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

Size: px
Start display at page:

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

Transcription

1 PES Institute of Technology, Bangalore South Campus (Formerly PES School of Engineering) (Hosur Road, 1KM before Electronic City, Bangalore ) Dept of MCA INTERNAL TEST (SCHEME AND SOLUTION) 2 Subject Name: Advanced Web Programming Subject Code: (13MCA43) 1. what is PHP? Discuss different control statements PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies. But PHP can do much more. if, elseif, else if ( ) elseif ( ) else switch switch ( ) case condition1 break; case condition2 break; while Syntax: while (condition) do do while (condition) for Example use of the for statement: for ( $n = 1; $n < 10; $n++) echo "$n<br>"; foreach

2 Versions of PHP prior to version 4 do not support the foreach statement. The following code should list the contents of the array. $tree = array("trunk", "branches", "leaves"); foreach ($tree as $part) echo "Tree part: $part "; break Is used to end the execution of a for, switch, or while statement continue This statement is used to skip the rest of the current loop. for ( $n = 1; $n < 10; $n++) echo "$n<br>"; if ($n == 5) continue; echo "This statement is skipped when $n = 5.<BR>"; 2. Pattren Matching in PHP Regular expressions are nothing more than a sequence or pattern of characters itself. They provide the foundation for pattern-matching functionality. Using regular expression you can search a particular string inside a another string, you can replace one string by another string and you can split a string into many chunks. PHP offers functions specific to two sets of regular expression functions, each corresponding to a certain type of regular expression. You can use any of them based on your comfort. POSIX Regular Expressions PERL Style Regular Expressions POSIX Regular Expressions The structure of a POSIX regular expression is not dissimilar to that of a typical arithmetic expression: various elements (operators) are combined to form more complex expressions. The simplest regular expression is one that matches a single character, such as g, inside strings such as g, haggle, or bag. Lets give explanation for few concepts being used in POSIX regular expression. After that we will introduce you with regular expression related functions. 1. preg_match() The preg_match() function searches string for pattern, returning true if pattern exists, and false otherwise. 2 preg_match_all() The preg_match_all() function matches all occurrences of pattern in string. 3 preg_replace() The preg_replace() function operates just like ereg_replace(), except that regular expressions can be used in the pattern and replacement input parameters.

3 4 preg_split() The preg_split() function operates exactly like split(), except that regular expressions are accepted as input parameters for pattern. 3. Develop an application to track users using cookie $name = $_POST['user']; $pwd = $_POST['pwd']; if ($_POST['on']) if ($name && $pwd) $content = $name."&". $pwd; setcookie("userdetails",$content, time()+120); elseif ($_POST['off']) setcookie("userdetails", ''); <html> <head> <title> Access Control with Cookie </title> </head> <body> <h1> Access Control with cookie </h1> if ($_POST['_check_']) checkform(); else printform(); function checkform() global $name,$pwd; if ($_POST['show']) echo "<h3> cookie contain ". $_COOKIE["UserDetails"]."<h3>";

4 else if(!$name!pwd) echo "<h3> Please enter usename and password </h3>"; else echo "<h3> you submitted $name and $pwd<h3>"; printform(); //checkform function printform() $thisurl = $_SERVER[PHP_SELF]; echo <<<_DONE <form action="$thisurl" method="post"> <table> <td> Enter your Name </td> <td><input type="text" length="20" name="user"></td> <td> password </td> <td><input type ="password" length="10" name="pwd"></td> <td><input type="submit" name="on" value =" Log On"/></td> <td><input type="submit" name="off" value =" Log Off"/></td> <td colspan="2" align="center"> <input type="submit" name="show" value="show the cookie" /> </td> <input type = "hidden" name="_check_" value="1" /> </table> </form>

5 _DONE; </body> </html> 4. Explain functions in PHP PHP functions are similar to other programming languages. A function is a piece of code which takes one more input in the form of parameter and does some processing and returns a value. You already have seen many functions like fopen() and fread() etc. They are built-in functions but PHP gives you option to create your own functions as well. There are two parts which should be clear to you Creating a PHP Function Calling a PHP Function In fact you hardly need to create your own PHP function because there are already more than 1000 of built-in library functions created for different area and you just need to call them according to your requirement. Creating PHP Function Its very easy to create your own PHP function. Suppose you want to create a PHP function which will simply write a simple message on your browser when you will call it. Following example creates a function called writemessage() and then calls it just after creating it. Note that while creating a function its name should start with keyword function and all the PHP code should be put inside and braces as shown in the following example below <html> <head> <title>writing PHP Function</title> </head> <body> /* Defining a PHP Function */ function writemessage() echo "You are really a nice person, Have a nice time!"; /* Calling a PHP Function */ writemessage(); </body> </html> This will display following result You are really a nice person, Have a nice time!

6 4. b. Write a note on file system in PHP Opening a file Reading a file Writing a file Closing a file Opening and Closing Files The PHP fopen() function is used to open a file. It requires two arguments stating first the file name and then mode in which to operate. Files modes can be specified as one of the six options in this table. Mode Purpose r Opens the file for reading only. Places the file pointer at the beginning of the file. r+ Opens the file for reading and writing.places the file w pointer at the beginning of the file. Opens the file for writing only.places the file pointer at the beginning of the file. If files does not exist then it attempts to create a file. w+ Opens the file for reading and writing only.places the file pointer at the beginning of the file. If files does notexist then it attempts to create a file. a Opens the file for writing only.places the file pointer at the end of the file.if files does not exist then it attempts to create a file. a+ Opens the file for reading and writing only.places the file pointer at the end of the file.if files does not exist then it attempts to create a file. fclose() function Reading a file Once a file is opened using fopen() function it can be read with a function called fread(). This function requires two arguments. These must be the file pointer and the length of the file expressed in bytes. Here are the steps required to read a file with PHP. Open a file using fopen() function. Get the file's length using filesize() function. Read the file's content using fread() function. Close the file with fclose() function. The following example assigns the content of a text file to a variable then displays those contents on the web page. //file1.php <html> <head> <title>reading a file using PHP</title> </head> <body> $filename = "tmp.txt"; $file = fopen( $filename, "r" ); if( $file == false ) echo ( "Error in opening file" );

7 exit(); $filesize = filesize( $filename ); $filetext = fread( $file, $filesize ); fclose( $file ); echo ( "File size : $filesize bytes" ); echo ( "<pre>$filetext</pre>" ); </body> </html> WRITING A FILE \\ File2.PHP $filename = "/home/user/guest/newfile.txt"; $file = fopen( $filename, "w" ); if( $file == false ) echo ( "Error in opening new file" ); exit(); fwrite( $file, "This is a simple test\n" ); fclose( $file ); 5. Write a program to track users using session tracking mechanism > session_start(); $name = $_POST['user']; $pwd = $_POST['pwd']; if ($_POST['on']) if ($name && $pwd) $_SESSION['user'] = $name; $_SESSION['pwd'] = $pwd; $_SESSION['counter'] += 1; elseif ($_POST['off']) unset($_session['user']); unset($_session['pwd']); unset($_session['counter']); <html> <head><title> acess control using session </title></head> <body> <h1> access control with sessions </h1> if ($_POST['_check_']) checkform(); else printform(); function checkform()

8 global $name,$pwd; if ($_POST['show']) echo "<h3> session contains ". $_SESSION['user']. " and ". $_SESSION['pwd']. "<h3>"; echo "<h3> you have logged on ". $_SESSION['counter']. " times </h3>"; else if (!$name $pwd ) echo "<h3> please enter user name and pw </h3>"; else echo "<h3> you have entered $name and $pwd <h3>"; printform(); // checkform function printform() $thisurl = $_SERVER[PHP_SELF]; echo <<<_DONE <form action="$thisurl" method="post"> <table> <td> Enter your Name </td> <td><input type="text" length="20" name="user"></td> <td> password </td> <td><input type ="password" length="10" name="pwd"></td> <td><input type="submit" name="on" value =" Log On"/></td> <td><input type="submit" name="off" value =" Log Off"/></td> <td colspan="2" align="center"> <input type="submit" name="show" value="show the Session" /> </td> <input type = "hidden" name="_check_" value="1" /> </table> </form> _DONE; </body> </html> 7. Write a program create XHTML form with Name, address line1, address line2 and text fields. On submitting, store the values in MySQL table. Retrieve and display the data based on name. Refer lab-2 program in Lab manual

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

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

Introduction. Server-side Techniques. Introduction. 2 modes in the PHP processor: Introduction Server-side Techniques PHP Hypertext Processor A very popular server side language on web Code embedded directly into HTML documents http://hk2.php.net/downloads.php Features Free, open source

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 5 if...else...elseif Statements

PHP 5 if...else...elseif Statements PHP 5 if...else...elseif Statements Conditional statements are used to perform different actions based on different conditions. PHP Conditional Statements Very often when you write code, you want to perform

More information

home.php 1/1 lectures/6/src/ include.php 1/1 lectures/6/src/

home.php 1/1 lectures/6/src/ include.php 1/1 lectures/6/src/ home.php 1/1 3: * home.php 5: * A simple home page for these login demos. 6: * David J. Malan 8: * Computer Science E-75 9: * Harvard Extension School 10: */ 11: // enable sessions 13: session_start();

More information

PhpT Point, Simply Easy Learning

PhpT Point, Simply Easy Learning The PHP Hypertext Pre-processor (PHP) is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software

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

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

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

PHP Introduction. Some info on MySQL which we will cover in the next workshop... PHP and MYSQL PHP Introduction PHP is a recursive acronym for PHP: Hypertext Preprocessor -- It is a widely-used open source general-purpose serverside scripting language that is especially suited for

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

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

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

M275 - Web Development using PHP and MySQL

M275 - Web Development using PHP and MySQL Arab Open University Faculty of computer Studies M275 - Web Development using PHP and MySQL Chapter 6 Flow Control Functions in PHP Summary This is a supporting material to chapter 6. This summary will

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

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

A QUICK GUIDE TO PROGRAMMING FOR THE WEB. ssh (then type your UBIT password when prompted) A QUICK GUIDE TO PROGRAMMING FOR THE WEB TO GET ACCESS TO THE SERVER: ssh Secure- Shell. A command- line program that allows you to log in to a server and access your files there as you would on your own

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

Shankersinh Vaghela Bapu Institue of Technology

Shankersinh Vaghela Bapu Institue of Technology Branch: - 6th Sem IT Year/Sem : - 3rd /2014 Subject & Subject Code : Faculty Name : - Nitin Padariya Pre Upload Date: 31/12/2013 Submission Date: 9/1/2014 [1] Explain the need of web server and web browser

More information

Important Points about PHP:

Important Points about PHP: Important Points about PHP: PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking,

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

Enterprise Knowledge Platform Adding the Login Form to Any Web Page

Enterprise Knowledge Platform Adding the Login Form to Any Web Page Enterprise Knowledge Platform Adding the Login Form to Any Web Page EKP Adding the Login Form to Any Web Page 21JAN03 2 Table of Contents 1. Introduction...4 Overview... 4 Requirements... 4 2. A Simple

More information

Controlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser.

Controlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser. Controlled Assessment Task Question 1 - Describe how this HTML code produces the form displayed in the browser. The form s code is displayed in the tags; this creates the object which is the visible

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

Final Exam. IT 3203 Introduction to Web Development. Rescheduling Final Exams. PHP Arrays. Arrays as Hashes. Looping over Arrays

Final Exam. IT 3203 Introduction to Web Development. Rescheduling Final Exams. PHP Arrays. Arrays as Hashes. Looping over Arrays IT 3203 Introduction to Web Development Introduction to PHP II April 5 Notice: This session is being recorded. Copyright 2007 by Bob Brown Final Exam The Registrar has released the final exam schedule.

More information

PHP 7.1 and SQL 5.7. Section Subject Page

PHP 7.1 and SQL 5.7. Section Subject Page One PHP Introduction 2 PHP: Hypertext Preprocessor 3 Some of its main uses 4 Two PHP Structure 5 Basic Structure of PHP 6 PHP Version etc 15 Use of Echo 17 Concatenating Echo 19 Use of Echo with Escape

More information

COMP519 Web Programming Lecture 27: PHP (Part 3) Handouts

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

More information

CPSC 481: CREATIVE INQUIRY TO WSBF

CPSC 481: CREATIVE INQUIRY TO WSBF CPSC 481: CREATIVE INQUIRY TO WSBF J. Yates Monteith, Fall 2013 Schedule HTML and CSS PHP HTML Hypertext Markup Language Markup Language. Does not execute any computation. Marks up text. Decorates it.

More information

Lab 4: Basic PHP Tutorial, Part 2

Lab 4: Basic PHP Tutorial, Part 2 Lab 4: Basic PHP Tutorial, Part 2 This lab activity provides a continued overview of the basic building blocks of the PHP server-side scripting language. Once again, your task is to thoroughly study the

More information

(Refer Slide Time: 01:12)

(Refer Slide Time: 01:12) Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #22 PERL Part II We continue with our discussion on the Perl

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

Server-side Web Development (I3302) Semester: 1 Academic Year: 2017/2018 Credits: 5 (50 hours) Dr Antoun Yaacoub

Server-side Web Development (I3302) Semester: 1 Academic Year: 2017/2018 Credits: 5 (50 hours) Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Server-side Web Development (I3302) Semester: 1 Academic Year: 2017/2018 Credits: 5 (50 hours) Dr Antoun Yaacoub 2 PHP forms This lecture

More information

UNIT-VI CREATING AND USING FORMS

UNIT-VI CREATING AND USING FORMS UNIT-VI CREATING AND USING FORMS To create a fully functional web application, you need to be able to interact with your users. The common way to receive information from web users is through a form. Forms

More information

Some things to watch out for when using PHP and Javascript when building websites

Some things to watch out for when using PHP and Javascript when building websites Some things to watch out for when using PHP and Javascript when building websites Les Hatton 10 Sep 2003 1 PHP PHP is a C-like language which evolved from Perl scripts originally produced by Rasmus Lerdorf

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

Web Site Development with HTML/JavaScrip

Web Site Development with HTML/JavaScrip Hands-On Web Site Development with HTML/JavaScrip Course Description This Hands-On Web programming course provides a thorough introduction to implementing a full-featured Web site on the Internet or corporate

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

Princeton University COS 333: Advanced Programming Techniques A Subset of PHP

Princeton University COS 333: Advanced Programming Techniques A Subset of PHP Princeton University COS 333: Advanced Programming Techniques A Subset of PHP Program Structure -----------------------------------------------------------------------------------

More information

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

Lecture 2 Unix and PHP. INLS 523 Web Databases Spring 2013 Rob Capra Lecture 2 Unix and PHP INLS 523 Web Databases Spring 2013 Rob Capra Server-Side Scripting Server-side scripting Scripts run on the server Scripts return HTML to the client Apache Open-source Perl and PHP

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

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

COM1004 Web and Internet Technology

COM1004 Web and Internet Technology COM1004 Web and Internet Technology When a user submits a web form, how do we save the information to a database? How do we retrieve that data later? ID NAME EMAIL MESSAGE TIMESTAMP 1 Mike mike@dcs Hi

More information

Database Connectivity using PHP Some Points to Remember:

Database Connectivity using PHP Some Points to Remember: Database Connectivity using PHP Some Points to Remember: 1. PHP has a boolean datatype which can have 2 values: true or false. However, in PHP, the number 0 (zero) is also considered as equivalent to False.

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

Web Programming Paper Solution (Chapter wise)

Web Programming Paper Solution (Chapter wise) PHP Session tracking and explain ways of session tracking. Session Tracking HTTP is a "stateless" protocol which means each time a client retrieves a Web page, the client opens a separate connection to

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

"Charting the Course... Intermediate PHP & MySQL Course Summary

Charting the Course... Intermediate PHP & MySQL Course Summary Course Summary Description In this PHP training course, students will learn to create database-driven websites using PHP and MySQL or the database of their choice. The class also covers SQL basics. Objectives

More information

SECTION 2: PROGRAMMING WITH MATLAB. MAE 4020/5020 Numerical Methods with MATLAB

SECTION 2: PROGRAMMING WITH MATLAB. MAE 4020/5020 Numerical Methods with MATLAB SECTION 2: PROGRAMMING WITH MATLAB MAE 4020/5020 Numerical Methods with MATLAB 2 Functions and M Files M Files 3 Script file so called due to.m filename extension Contains a series of MATLAB commands The

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

Understanding Basic SQL Injection

Understanding Basic SQL Injection Understanding Basic SQL Injection SQL injection (also known as SQLI) is a code injection technique that occurs if the user-defined input data is not correctly filtered or sanitized of the string literal

More information

Spring 2014 Interim. HTML forms

Spring 2014 Interim. HTML forms HTML forms Forms are used very often when the user needs to provide information to the web server: Entering keywords in a search box Placing an order Subscribing to a mailing list Posting a comment Filling

More information

LESSON 3. In this lesson you will learn about the conditional and looping constructs that allow you to control the flow of a PHP script.

LESSON 3. In this lesson you will learn about the conditional and looping constructs that allow you to control the flow of a PHP script. LESSON 3 Flow Control In this lesson you will learn about the conditional and looping constructs that allow you to control the flow of a PHP script. In this chapter we ll look at two types of flow control:

More information

IEEM 230. PHP Basics, Part IV. Objectives of the lab:

IEEM 230. PHP Basics, Part IV. Objectives of the lab: IEEM 230. PHP Basics, Part IV Objectives of the lab: Learn the fundamentals of PHP - different types of data inputs using web FORMS - I/O from files - more PHP practice Standard PHP reference website:

More information

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Princess Nourah bint Abdulrahman University. Computer Sciences Department Princess Nourah bint Abdulrahman University Computer Sciences Department 1 And use http://www.w3schools.com/ PHP Part 3 Objectives Creating a new MySQL Database using Create & Check connection with Database

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

Server-side Web Development (I3302) Semester: 1 Academic Year: 2017/2018 Credits: 4 (50 hours) Dr Antoun Yaacoub

Server-side Web Development (I3302) Semester: 1 Academic Year: 2017/2018 Credits: 4 (50 hours) Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Server-side Web Development (I3302) Semester: 1 Academic Year: 2017/2018 Credits: 4 (50 hours) Dr Antoun Yaacoub 2 Regular expressions

More information

Dynamic Form Processing Tool Version 5.0 November 2014

Dynamic Form Processing Tool Version 5.0 November 2014 Dynamic Form Processing Tool Version 5.0 November 2014 Need more help, watch the video! Interlogic Graphics & Marketing (719) 884-1137 This tool allows an ICWS administrator to create forms that will be

More information

Part A Short Answer (50 marks)

Part A Short Answer (50 marks) Part A Short Answer (50 marks) NOTE: Answers for Part A should be no more than 3-4 sentences long. 1. (5 marks) What is the purpose of HTML? What is the purpose of a DTD? How do HTML and DTDs relate to

More information

Starting To Write PHP Code

Starting To Write PHP Code Starting To Write PHP Code April 22 nd 2014 Thomas Beebe Advanced DataTools Corp (tom@advancedatatools.com) Tom Beebe Tom is a Senior Database Consultant and has been with Advanced DataTools for over 10

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

PES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore WEB PROGRAMMING Solution Set II

PES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore WEB PROGRAMMING Solution Set II PES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore 560 100 WEB PROGRAMMING Solution Set II Section A 1. This function evaluates a string as javascript statement or expression

More information

cis20.2-spring2010-sklar-lecii.4 1

cis20.2-spring2010-sklar-lecii.4 1 cis20.2 design and implementation of software applications 2 spring 2010 lecture # II.4 today s topics: introduction to php on-line documentation http://www.php.net (php home page) http://www.php.net/manual/en/

More information

PHP: File upload. Unit 27 Web Server Scripting L3 Extended Diploma

PHP: File upload. Unit 27 Web Server Scripting L3 Extended Diploma PHP: File upload Unit 27 Web Server Scripting L3 Extended Diploma 2016 Criteria M2 M2 Edit the contents of a text file on a web server using web server scripting Tasks We will go through a worked example

More information

Flow Control. Copyleft 2005, Binnur Kurt

Flow Control. Copyleft 2005, Binnur Kurt 10 Flow Control Copyleft 2005, Binnur Kurt Content if, if/else, switch for, while, do/while 513 Conditional Statements Very often when you write code, you want to perform different actions for different

More information

Executing Simple Queries

Executing Simple Queries Script 8.3 The registration script adds a record to the database by running an INSERT query. 1

More information

COMS 469: Interactive Media II

COMS 469: Interactive Media II COMS 469: Interactive Media II Agenda Review Files and Directories Review User Defined Functions Cookies File Includes CMS Admin Login Review User Defined Functions Input arguments Output Return values

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

Arithmetic and Assignment Operators

Arithmetic and Assignment Operators PHP - Part 2 More operators... Arithmetic and Assignment Operators e.g., using + and = $IntA=5; $intb=8; $intc=$inta+$intb; //intc is 13 // Same +, -, *, / and % as C $inta + = $intb; //as in C Bitwise:

More information

1 Explain the following in brief, with respect to usage of Ajax

1 Explain the following in brief, with respect to usage of Ajax PES Institute of Technology, Bangalore South Campus (Formerly PES School of Engineering) (Hosur Road, 1KM before Electronic City, Bangalore-560 100) INTERNAL TEST (SCHEME AND SOLUTION) 1 Subject Name:

More information

ITS331 IT Laboratory I: (Laboratory #11) Session Handling

ITS331 IT Laboratory I: (Laboratory #11) Session Handling School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University ITS331 Information Technology Laboratory I Laboratory #11: Session Handling Creating

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

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly Web Programming Lecture 10 PHP 1 Purpose of Server-Side Scripting database access Web page can serve as front-end to a database Ømake requests from browser, Øpassed on to Web server, Øcalls a program to

More information

CGI Programming. What is "CGI"?

CGI Programming. What is CGI? CGI Programming What is "CGI"? Common Gateway Interface A means of running an executable program via the Web. CGI is not a Perl-specific concept. Almost any language can produce CGI programs even C++ (gasp!!)

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

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

DC71 INTERNET APPLICATIONS JUNE 2013

DC71 INTERNET APPLICATIONS JUNE 2013 Q 2 (a) With an example show text formatting in HTML. The bold text tag is : This will be in bold. If you want italics, use the tag, as follows: This will be in italics. Finally, for

More information

ABOUT WEB TECHNOLOGY COURSE SCOPE:

ABOUT WEB TECHNOLOGY COURSE SCOPE: ABOUT WEB TECHNOLOGY COURSE SCOPE: The booming IT business across the globe, the web has become one in every of the foremost necessary suggests that of communication nowadays and websites are the lifelines

More information

FILE TYPES 1/2/12 CHAPTER 5 WORKING WITH FILES AND DIRECTORIES OBJECTIVES. Binary. Text PHP PROGRAMMING WITH MYSQL, 2ND EDITION

FILE TYPES 1/2/12 CHAPTER 5 WORKING WITH FILES AND DIRECTORIES OBJECTIVES. Binary. Text PHP PROGRAMMING WITH MYSQL, 2ND EDITION CHAPTER 5 WORKING WITH FILES AND DIRECTORIES PHP PROGRAMMING WITH MYSQL 2 ND EDITION MODIFIED BY ANITA PHILIPP SPRING 2012 2 OBJECTIVES In this chapter, you will: Understand file type and permissions Work

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

Mini-Matlab Lesson 5: Functions and Loops

Mini-Matlab Lesson 5: Functions and Loops Mini-Matlab Lesson 5: Functions and Loops Writing Functions and Scripts Contents Relational and logical operators IF loops FOR loops WHILE loops Scripts and functions Defining and using functions Anonymous

More information

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

Introduction. This course Software Architecture with Java will discuss the following topics: Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

More information

Chapter 15 Java Server Pages (JSP)

Chapter 15 Java Server Pages (JSP) Sungkyunkwan University Chapter 15 Java Server Pages (JSP) Prepared by J. Jung and H. Choo Web Programming Copyright 2000-2018 Networking 2000-2012 Networking Laboratory Laboratory 1/30 Server & Client

More information

PHP can also increase your productivity enormously, both in development time and maintenance time.

PHP can also increase your productivity enormously, both in development time and maintenance time. 4.0 Introduction to stands for Hypertext Processor A recursive definition!. was originally created by Rasmus Lerdorf in 1995. The main implementation of is now produced by The Group and serves as the formal

More information

DC71 INTERNET APPLICATIONS DEC 2014

DC71 INTERNET APPLICATIONS DEC 2014 Q.2 a. What are the Core Attributes of XHTML elements? Id - Uniquely identifies the element in a page. All ids in a document must be distinct. Among other uses, a URL ending in #some id can lead directly

More information

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

Setting Up a Development Server What Is a WAMP, MAMP, or LAMP? Installing a WAMP on Windows Testing the InstallationAlternative WAMPs Installing a Setting Up a Development Server What Is a WAMP, MAMP, or LAMP? Installing a WAMP on Windows Testing the InstallationAlternative WAMPs Installing a LAMP on Linux Working Remotely Introduction to web programming

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

CLIL-4-PHP-4. Files - part 2. There are three functions that allow you to work more intimately with the contents

CLIL-4-PHP-4. Files - part 2. There are three functions that allow you to work more intimately with the contents Files - part 2 Other file functions bool rewind ( resource handle) int fseek ( resource handle, int offset [, int from_where]) There are three functions that allow you to work more intimately with the

More information

Hyper- Any time any where go to any web pages. Text- Simple Text. Markup- What will you do

Hyper- Any time any where go to any web pages. Text- Simple Text. Markup- What will you do HTML Interview Questions and Answers What is HTML? Answer1: HTML, or HyperText Markup Language, is a Universal language which allows an individual using special code to create web pages to be viewed on

More information

Best PHP Training in PUNE & Best PHP Training Institute in MAHARASHTRA

Best PHP Training in PUNE & Best PHP Training Institute in MAHARASHTRA Best Training in PUNE & Best Training Institute in MAHARASHTRA RAHITECH is the biggest training center in PUNE with high tech infrastructure and lab facilities and the options of opting for multiple courses

More information

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

Introduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003 Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations

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

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

By the end of this section of the practical, the students should be able to: By the end of this section of the practical, the students should be able to: Display output with PHP built-in and user defined variables, data types and operators Work with text files in PHP Construct

More information

Form Processing in PHP

Form Processing in PHP Form Processing in PHP Forms Forms are special components which allow your site visitors to supply various information on the HTML page. We have previously talked about creating HTML forms. Forms typically

More information

4th year. more than 9 years. more than 6 years

4th year. more than 9 years. more than 6 years 4th year more than 9 years more than 6 years Apache (recommended) IIS MySQL (recommended) Oracle Client Webserver www.xyz.de Webpage (Output) Output Call MySQL-Database Dataexchange PHP Hello World

More information

JavaScript Functions, Objects and Array

JavaScript Functions, Objects and Array JavaScript Functions, Objects and Array Defining a Function A definition starts with the word function. A name follows that must start with a letter or underscore, followed by any number of letters, digits,

More information

Advanced HTML 5.1 INTRODUCTION 5.2 OBJECTIVES

Advanced HTML 5.1 INTRODUCTION 5.2 OBJECTIVES 5 Advanced HTML 5.1 INTRODUCTION An effective way to organize web documents, visually, and also logically, by dividing the page into different parts is the necessity of the website today. In each part

More information

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

Introduction to Databases. Key Concepts. Calling a PHP Script 5/17/2012 PHP I Introduction to Databases PHP I PHP in HTML Calling functions Form variables Identifies and data types Operators Decisions Conditionals Arrays Multi dimensional arrays Sorting arrays Array manipulation

More information

Web Focused Programming With PHP

Web Focused Programming With PHP Web Focused Programming With PHP May 20 2014 Thomas Beebe Advanced DataTools Corp (tom@advancedatatools.com) Tom Beebe Tom is a Senior Database Consultant and has been with Advanced DataTools for over

More information

UNIT I Java Bean, HTML & Javascript

UNIT I Java Bean, HTML & Javascript SIDDHARTH GROUP OF INSTITUTIONS :: PUTTUR Siddharth Nagar, Narayanavanam Road 517583 QUESTION BANK (DESCRIPTIVE) Subject with Code : Web Technologies (16MC820) Year & Sem: II-MCA & II-Sem Course & Branch:

More information

CS105 Perl: Perl CGI. Nathan Clement 24 Feb 2014

CS105 Perl: Perl CGI. Nathan Clement 24 Feb 2014 CS105 Perl: Perl CGI Nathan Clement 24 Feb 2014 Agenda We will cover some CGI basics, including Perl-specific CGI What is CGI? Server Architecture GET vs POST Preserving State in CGI URL Rewriting, Hidden

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

CS Homework 6. Deadline. Purpose. How to submit. Important notes. Problem 1. Spring CS Homework 6 p. 1

CS Homework 6. Deadline. Purpose. How to submit. Important notes. Problem 1. Spring CS Homework 6 p. 1 Spring 2018 - CS 328 - Homework 6 p. 1 Deadline Due by 11:59 pm on Sunday, March 11, 2018. Purpose CS 328 - Homework 6 To encourage you to look over the course PHP style standards, and to give you more

More information