Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 3 PHP Advanced.

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

PHP: Date() Function The PHP date() function formats a timestamp to a more readable date and time.
Powerpoint Templates Page 1 Powerpoint Templates Server Side Scripting PHP.
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK)
Cookies, Sessions. Server Side Includes You can insert the content of one file into another file before the server executes it, with the require() function.
Chapter 51 Scripting With JSP Elements JavaServer Pages By Xue Bai.
More on PHP Coding Lab no. 6 Advance Database Management System.
SWU, Computer systems and technologies. The Objective of This Lecture To give you a very high-level overview of some of the tools for Web Programming.
>> PHP: Access Control & Security. Authentication: Source Authentication Source Hard-coded File-Based The username and password is available inside the.
Chapter 10 Managing State Information Using Sessions.
Chapter 11 C File Processing Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Intermediate PHP & MySQL
Using Session Control in PHP tMyn1 Using Session Control in PHP HTTP is a stateless protocol, which means that the protocol has no built-in way of maintaining.
Kyle MacLachlan.  Used To Format a Date/Time  Syntax: › date(format,timestamp)  format: Required, specifies format  timestamp:Optional, specifies.
04/09/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
PHP Tutorial - Anas Jaghoub Chapter 2 Control Structures.
PHP Advance. Agenda Server side Includes File Handling Cookies Sessions Error/Exception handling Database handling with MySQL sending.
Week 9 PHP Cookies and Session Introduction to JavaScript.
CSE 154 LECTURE 12: COOKIES. Including files: include include("filename"); PHP include("header.html"); include("shared-code.php"); PHP inserts the entire.
12/3/2012ISC329 Isabelle Bichindaritz1 PHP and MySQL Advanced Features.
PHP1-1 PHP Lecture 2 Xingquan (Hill) Zhu
Lecture 8 – Cookies & Sessions SFDV3011 – Advanced Web Development 1.
1 Chapter 9 – Cookies, Sessions, FTP, and More spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
PHP2. PHP Form Handling The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. Name: Age:
Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.
COOKIES and SESSIONS. COOKIES 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.
Cookies and Sessions IDIA 618 Fall 2014 Bridget M. Blodgett.
1 Chapter 7 – Object-Oriented Programming and File Handling spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information.
Storing and Retrieving Data
Outline Overview Opening a file How to create a file ? Closing a File Check End-of-file Reading a File Line by Line Reading a File Character by Character.
Server-Side Scripting with PHP ISYS 475. PHP Manual Website
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Files & Directories.
LECTURE 4 Files, File open, Read, Write. File Upload - In this lecture we will teach you how to open, read, and close a file on the server. - PHP Open.
8 th Semester, Batch 2008 Department Of Computer Science SSUET.
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
Chapter 11 File Processing. Objectives In this chapter, you will learn: –To be able to create, read, write and update files. –To become familiar with.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
CHAPTER 8 PHP Advanced อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
chap8 Chapter 12 Files (reference: Deitel ’ s chap 11)
PHP Session ISYS 475. Session The web server starts a session when a visitor visiting your web site and assigns a unique id, the session id for the session.
Sessions Brendan Knight A visitor accessing your web site is assigned a unique id. This id links to specific data that remains on the server. Sessions.
SESSIONS 27/2/12 Lecture 8. ? Operator Similar to the if statement but returns a value derived from one of two expressions by a colon. Syntax: (expression)
PHP and Sessions. Session – a general definition The GENERAL definition of a session in the “COMPUTER WORLD” is: The interactions (requests and responses)
8 th Semester, Batch 2008 Department of Computer Science SSUET.
 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.
ITM © Port,Kazman 1 ITM 352 Cookies. ITM © Port,Kazman 2 Problem… r How do you identify a particular user when they visit your site (or any.
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
Cookies and Sessions in PHP. Arguments for the setcookie() Function There are several arguments you can use i.e. setcookie(‘name’, ‘value’, expiration,
Unit-6 Handling Sessions and Cookies. Concept of Session Session values are store in server side not in user’s machine. A session is available as long.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
 2007 Pearson Education, Inc. All rights reserved C File Processing.
PHP File Handling. Opening a file Fopen(filename,mode) Closing a file Fclose(filename)
Week 7 Server side programming PHP Scripting Language MySQL Database Apache Server IT4103 Web Programming
CHAPTER 5 SERVER SIDE SCRIPTING
CGS 3066: Web Programming and Design Spring 2016
TMF1414 Introduction to Programming
19.10 Using Cookies A cookie is a piece of information that’s stored by a server in a text file on a client’s computer to maintain information about.
Chapter 19 PHP Part III Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice Hall ©
1 CHAPTER 10 ADVANCED PHP.
Advanced PHP Lecture by Nutthapat Keawrattanapat
<?php require("header.htm"); ?>
Cookies Cookie :- A cookie is often used to identify a user. A cookie is often used to identify a user. A cookie is a small file that the server embeds.
Cookies and Sessions.
Advanced Concepts and AJAX
PHP-II.
Presentation transcript:

Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 3 PHP Advanced

Chapter Objectives Some Build-In Functions : PHP Date PHP Include PHP File PHP Cookies PHP Sessions PHP

PHP Date PHP Date / Time Introduction The date/time functions allow you to extract and format the date and time on the server. These functions depend on the locale settings of the server! PHP Date - Format the Date The first parameter in the date() function specifies how to format the date/time. It uses letters to represent date and time formats. Here are some of the letters that can be used: d - The day of the month (01-31) m - The current month, as a number (01-12) Y - The current year in four digits Other characters, like"/", ".", or "-" can also be inserted between the letters to add additional formatting

Example

PHP Include File Server Side Includes (SSI) are used to create functions, headers, footers, or elements that will be reused on multiple pages. You can insert the content of a file into a PHP file before the server executes it, with the include() or require() function. The two functions are identical in every way, except how they handle errors. The include() function generates a warning (but the script will continue execution) while the require() function generates a fatal error (and the script execution will stop after the error).

PHP File Handling The fopen() function opens a file or URL. If fopen() fails, it returns FALSE and an error on failure. You can hide the error output by adding an in front of the function name.

Example

PHP File Handling Closing a File The fclose() function is used to close an open file: Check End-of-file The feof() function checks if the "end-of-file" (EOF) has been reached. You cannot read from files opened in w, a, and x mode!

PHP File Handling Reading a File Line by Line The fgets() function is used to read a single line from a file. After a call to this function the file pointer has moved to the next line. Reading a File Character by Character The fgetc() function is used to read a single character from a file. After a call to this function the file pointer moves to the next character.

PHP File Handling PHP fwrite() Function The fwrite() writes to an open file. The function will stop at the end of the file or when it reaches the specified length, whichever comes first. This function returns the number of bytes written, or FALSE on failure.

PHP File Handling PHP unlink() Function The unlink() function deletes a file. This function returns TRUE on success, or FALSE on failure.

PHP Cookies 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 send the cookie too. With PHP, you can both create and retrieve cookie values. How to Create a Cookie? The setcookie() function is used to set a cookie. The setcookie() function must appear BEFORE the tag.

PHP Cookies How to Retrieve a Cookie Value? The PHP $_COOKIE variable is used to retrieve a cookie value.  isset() function to find out if a cookie has been set  When deleting a cookie you should assure that the expiration date is in the past.

PHP Sessions A PHP session variable is used to store information about, or change settings for a user session. Session variables hold information about one single user, and are available to all pages in one application. Sessions work by creating a unique id (UID) for each visitor and store variables based on this UID. The UID is either stored in a cookie or is propagated in the URL. Starting a PHP Session Before you can store user information in your PHP session, you must first start up the session. The session_start() function must appear BEFORE the tag.

PHP Sessions Storing a Session Variable The correct way to store and retrieve session variables is to use the PHP $_SESSION variable.

PHP Sessions The isset() function checks if the "views" variable has already been set. Destroying a Session If you wish to delete some session data, you can use the unset() or the session_destroy() function.

PHP Sending s PHP allows you to send s directly from a script. The PHP mail() function is used to send s from inside a script.

Example