Web Programming Paper Solution (Chapter wise)

Similar documents
Lecture 5. Monday, February 1, 2016

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

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

PHP & My SQL Duration-4-6 Months

PHP. Introduction. PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server

Static Webpage Development

UNIT-VI CREATING AND USING FORMS

By completing this practical, the students will learn how to accomplish the following tasks:

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

Server-Side Web Programming: Python (Part 1) Copyright 2017 by Robert M. Dondero, Ph.D. Princeton University

CITS1231 Web Technologies. PHP s, Cookies and Session Control

Web Programming/Scripting: PHP and AJAX Refresher

Professional Course in Web Designing & Development 5-6 Months

DC71 INTERNET APPLICATIONS DEC 2014

Introduction to HTTP. Jonathan Sillito

Introduction to PHP. Handling Html Form With Php. Decisions and loop. Function. String. Array

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

Produced by. Web Development. Eamonn de Leastar Department of Computing, Maths & Physics Waterford Institute of Technology

Introduction to PHP (PHP: Hypertext Preprocessor)

PHP State Maintenance (Cookies, Sessions, Hidden Inputs)

Backend Web Frameworks

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

Get in Touch Module 1 - Core PHP XHTML

BEGINNER PHP Table of Contents

CSE 154 LECTURE 13: SESSIONS

CSc 337 Final Examination December 13, 2013

WEBD 236 Web Information Systems Programming

CMPS 401 Survey of Programming Languages

PHP Hypertext Preprocessor

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

CSE 154 LECTURE 8: FORMS

How to work with cookies and sessions

Web Scripting using PHP

Tooling for Ajax-Based Development. Craig R. McClanahan Senior Staff Engineer Sun Microsystems, Inc.

PHP. Interactive Web Systems

Web Scripting using PHP

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

CPSC 481: CREATIVE INQUIRY TO WSBF

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

Varargs Training & Software Development Centre Private Limited, Module: HTML5, CSS3 & JavaScript

Build a Subfile with PHP

PHP: Code Reuse & Functions

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

Database Systems Fundamentals

SCRIPTING, DATABASES, SYSTEM ARCHITECTURE

PHPoC vs PHP > Overview. Overview

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

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

CS144 Notes: Web Standards

JavaScript CSCI 201 Principles of Software Development

FOR MORE PAPERS LOGON TO

PHPoC. PHPoC vs PHP. Version 1.1. Sollae Systems Co., Ttd. PHPoC Forum: Homepage:

EXPERIMENT- 9. Login.html

Web Development & Design Foundations with HTML5 & CSS3 Instructor Materials Chapter 2 Test Bank

Jquery Ajax Json Php Mysql Data Entry Example

PHP INTERVIEW QUESTION-ANSWERS

WEB TECHNOLOGY TUTORIAL SESSION #6 FOR WE CREATE IDENTITY. Module 1 - We Create Identity

Executing Simple Queries

Submitting forms (client-side)

High Availability/ Clustering with Zend Platform

CICS 515 b Internet Programming Week 2. Mike Feeley

Dreamweaver Basics Workshop

$headers="from: Mail",$mesg,$headers); if ($str==true) { echo "Message sent ";

WEBD 236 Web Information Systems Programming

11 Database Management

All India Council For Research & Training

PROFESSIONAL TRAINING

Using htmlarea & a Database to Maintain Content on a Website

(Frequently Asked Questions)

PHP. MIT 6.470, IAP 2010 Yafim Landa

CSE 154 LECTURE 9: SUBMITTING DATA (POST)

PHP-FIG Home Blog PSRs Personnel Bylaws FAQs Get Involved PSR-2: Coding Style Guide

G I F T U N I V E R S I T Y

James Woods Regional High School

This is CS50. Harvard College Fall Quiz 1 Answer Key

1 Form Basics CSC309

Programming for the Web with PHP

How to use the MVC pattern to organize your code

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

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

Objectives. Chapter 10. Developing Object-Oriented PHP. Introduction to Object-Oriented Programming

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

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

Hyperlinks, Tables, Forms and Frameworks

CSE 154 LECTURE 21: COOKIES

CSE 154 LECTURE 21: COOKIES

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

How to Make a Contact Us PAGE in Dreamweaver

Web basics: HTTP cookies

Creating HTML files using Notepad

CSC309: Introduction to Web Programming. Lecture 8

PHP with data handling

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

Form Processing in PHP

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

Alpha College of Engineering and Technology. Question Bank

Lab 4: Basic PHP Tutorial, Part 2

Web basics: HTTP cookies

Web Focused Programming With PHP

If you re serious about Cookie Stuffing, take a look at Cookie Stuffing Script.

Transcription:

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 the Web server and the server automatically does not keep any record of previous client request. Still there are following four ways to maintain session between web client and web server: 1. Cookies 2. Hidden form fields <input type="hidden" name="sessionid" value="12345"> 3. URL rewriting http://xyz.com/file.htm?sessionid=12345 4. Session PHP session To overcome problems of cookies, session are used. To create session <?php session_start()?> Write this statement at top of page, before any HTML tag code. To put value inside session $_SESSION[ name ]=value; To read value from session $var = $_SESSION[ name ]; They are private and secure, they are deleted when user closes browser (session with domain). Values of session variables are stored on server not client machine like cookie. Example webpage <?php session_start(); //to start session?> <!DOCTYPE html> <html> <head> <title>session via PHP form</title> <style type="text/css"> body font-family: "georgia"; size: 40px; </style> <?php if(count($_post))//set session value foreach($_post as $name=>$value) if($name!='submit') $_SESSION[$name] = $value; echo "<pre>"; //print values of session print_r($_session); echo "</pre>"; Page 1 of 6

session_destroy();//to destroy session?> </head> <body> <form action="" method="post" name="temp"> Name : <input type="text" value="" name="name" maxlength=30><br> Age : <input type="number" maxlength=2 value="" name="age"><br> <input type="submit" name="submit" value="ok"> </form> </body> </html> Page 2 of 6

PHP string functions. <!DOCTYPE html> <html> <head> <title>string functions in PHP</title> </head> <body> <?php $str = " this is Text. "; echo $str; //intitial string echo "<br>strtolower(str) :". strtolower($str); //lowercase string echo "<br>strtoupper(str) :". strtoupper($str); //uppercase string echo "<br>ucfirst(str) :". ucfirst($str); //sentense case echo "<br>ucwords(str) :". ucwords($str); //camel case echo "<br>strlen(str) :". strlen($str); //string length echo "<br>trim(str) :". trim($str); //trim the leading and trailing spaces from string echo "<br>strstr(str1,str2) :". strstr($str, "Te"); //find str2 in str1 and print ahead else blank echo "<br>str_replace(str1,str2,str3) :". str_replace("is","was",$str); //replace all str1 with str2 in str3 echo "<br>str_repeat(str,n) :". str_repeat($str,2); //repeat str for n times echo "<br>substr(str,pos) :". substr($str,5); //prinf from pos in str else blank, indexing starts from 0 echo "<br>strpos(str1,str2) :". strpos($str,"this"); //show location of str2 in str1 else null?> </body> </html> Page 3 of 6

Control structures in PHP (if-else, for, foreach, while, do-while, break, continue, switch, return, include, include_once, require, require_once, goto) <!doctype html> <html> <head> <title>control structures in PHP</title> </head> <body> <?php include("xyz.php");//import xyz.php file, if not found error, but try to execute further code include_once("xyz.php");//same as include but multiple include statements for same file will be ignored require("xyz.php");//import xyz.php file, if not found then stop executing further and show error require_once("xyz.php");//same as require but multiple require statements for same file will be ignored //if-else xyz:$i = 2; if($i%2==0)//if(condition) echo "even"; //true part code else echo "odd"; //false part code //for loop for($i=1; $i<4; $i++ )//for(initialization of loop variable; breaking condition; increment/decrement) //code to repeat if($i==2) continue;//if condition meets then without executing further code go for next loop of i if($i==3) break;//if condition meets then without executing further code come out of loop i echo $i; goto xyz;//unconditional jump to labeled xyz code line //while loop $i=1; while($i<4)//while(condition to break loop) echo "$i"; //code to repeat //do-while loop $i=1; do echo $i; while($i<4);//execute at least once and then check condition to break loop //switch loop $i=1; Page 4 of 6

switch($i)//switch(multi valued variable) case 1: echo "one"; break; //case value: code; break; case 2: echo "two"; break; default: echo "other";//default case function inc($i) return $i++;//return increment value; echo inc(10);//echo statement will catch returned value by inc function?> </body> </html> Page 5 of 6

PHP framework. PHP frameworks streamline the the development of web applications written in PHP by providing a basic structure for which to build the web applications. In other words, PHP frameworks help to promote rapid application development (RAD), which saves you time, helps build more stable applications, and reduces the amount of repetitive coding for developers. Frameworks can also help beginners to build more stable apps by ensuring proper database interaction and coding on the presentation layer. This allows you to spend more time creating the actual web application, instead of spending time writing repetitive code. The general idea behind the workings of a PHP framework is referred to as Model View Controller (MVC). MVC is an architectural pattern in programming that isolates business logic from the UI, allowing one to be modified separately from the other (also known as separation of concerns). With MVC, Model refers to data, View refers to the presentation layer, and Controller to the application or business logic. Basically, MVC breaks up the development process of an application, so you can work on individual elements while others are unaffected. Essentially, this makes coding in PHP faster and less complicated. Why to use framework? speeding up the development process Reusing code across similar projects pre-built modules for performing tedious coding tasks Stability the availability of PHP frameworks is extensive When to use framework? In case of beginners to reduce or eliminate bad coding and speed up the build process. When working on a project with tight deadlines, utilizing a PHP framework is a huge benefit that can greatly speed up the coding process. Components of framework to look for? easy of use, rapid development/performance, popularity amongst other developers, strong features, and support/forums Best PHP frameworks available? Zend, cakephp, Symfony, codeigniter, Seagull Page 6 of 6