V 1.0 OE NIK 2013 PHP+SQL 7. Directory Management GD File Uploads Exercises 1.

Slides:



Advertisements
Similar presentations
Cheryl Jelks Trainer/Applications Support Analyst Richland School District One.
Advertisements

CHAPTER 3 MORE ON FORM HANDLING INCLUDING MULTIPLE FILES WRITING FUNCTIONS.
1 Chapter 5 – Handling HTML Controls in Web Pages spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
CIS101 Introduction to Computing Week 08. Agenda Your questions JavaScript text Resume project HTML Project Six This week online Next class.
HTML Form and PHP IST Review of Previous Class HTML table and PHP array Winner is chosen automatically using rand() function.
web controls  standard controls  validation controls  rich controls.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 14 – Student Grades Application: Introducing.
Python and Web Programming
Uploading Files. Why? By giving a user the option to upload a file you are creating an interactive page You can enable users have a greater web experience.
BSC Food Distribution 8181 NW 36 Street, Suite 14-D Doral, FL Phone: Fax:
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
1 Events Lect 8. 2 Event-driven Pages one popular feature of the Web is its interactive nature e.g., you click on buttons to make windows appear e.g.,
MS3304: Week 4 PHP & HTML Forms. Overview HTML Forms elements refresher Sending data to a script via an HTML form –The post vs. get methods –Name value.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
PHP : Hypertext Preprocessor
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.
HTML Forms What is a form.
Lecture 6 – Form processing (Part 1) SFDV3011 – Advanced Web Development 1.
Lab Assignment 7 | Web Forms and Manipulating Strings Interactive Features Added In this assignment you will continue the design and implementation of.
Lesson 13: Building Web Forms Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver CS6.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Homework for October 2011 Nikolay Kostov Telerik Corporation
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
MKTG 476 FRONTPAGE II Lars Perner, Instructor 1 FrontPage II File structure and references File structure and references Editing standard HTML files Editing.
ASP.Net, Web Forms and Web Controls 1 Outline Web Controls Text and Graphics Controls AdRotator Control Validation Controls.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
HTML and FORMS.  A form is an area that can contain form elements.  Form elements are elements that allow the user to enter information (like text fields,
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
HTML Form and PHP IST Review of Previous Class HTML table and PHP array Winner is chosen randomly using rand() function.
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
PHP Form Introduction Getting User Information Text Input.
Part 4 Processing and saving data with CGI/Perl Psychological Science on the Internet: Designing Web-Based Experiments From the Ground Up R. Chris Fraley.
Introduction To HTML Form Inputs Written By George Gimian.
HTML JAVASCRIPT. CONTENTS Javascript Example NOSCRIPT Tag Advantages Summary Exercise.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
Introduction to HTML. _______________________________________________________________________________________________________________ 2 Outline Key issues.
CGI in Context CGI is Common Gateway Interface, supporting a greater degree of interaction between the user and a Web page, most commonly by means of a.
Chapter 9 Quick Links Slide 2 Performance Objectives Understanding Forms Planning Forms Creating Forms Creating Text Fields Creating Hidden Fields Creating.
Basic ActionScript and PHP Cis 126. Getting Started set up a basic folder structure so we can keep our files organized. Mirror this structure on your.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
More HTML Images and Links. Links An anchor tag (a) is used to define a link, but you also need to add something to the anchor tag – the destination of.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
Learning Aim C.  In this section we will look at how text, tables, forms and frames can be used in web pages.
HTML FORM AND PHP IST 210: Organization of Data IST210 1.
HTML FORM. Form HTML Forms are used to select different kinds of user input. HTML forms are used to pass data to a server. A form can contain input elements.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
Advanced HTML Tags:.
PHP+SQL 4. Password management (password hashing)
PHP+SQL 3. Files, directories, images TWIG File-based "database"
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Simple Add-Ons from Disus
Intro to PHP & Variables
Validation and Building Small Apps
More elements 10 Basic elements.
Tutorial Tutorial Read all the directions before proceeding
Visual Programming week # 06
Mr. Justin “JET” Turner CSCI 3000 – Fall 2016 Section DA MW 4:05-5:20
Presentation transcript:

V 1.0 OE NIK 2013 PHP+SQL 7. Directory Management GD File Uploads Exercises 1

V 1.0 OE NIK 2013 PHP+SQL 7. Directory Management GD File Uploads Exercises 2

V 1.0 Directory Functions getcwd(), chdir() opendir(), readdir(), closedir(), rewinddir() scandir(), glob() realpath() 3 OE NIK 2013

V 1.0 GD Functions image*, $im=imagecreatefromjpeg($path) //png, gif, wbmp imagesy($im), imagesx($im) $index=imagecolorat($im, X, Y); $rgb=imagecolorsforindex($im, $index); $index=imagecolorallocate($im, R, G, B); imagesetpixel($im, X, Y, $index); 4 OE NIK 2013

V 1.0 GD Example – pagetitle.php 5 OE NIK 2013

V 1.0 GD Example – getChannel.php 6 OE NIK 2013

V 1.0 Upload file An HTML form should be used to upload files (files are sent after the request, just like the POST) MAX_FILE_SIZE, upload_max_filesize, max_file_uploads, post_max_size, LimitRequestBody 7 OE NIK 2013

V 1.0 Upload Example – Uploader.php $file="myfile"; $DIR_destination="images/" IF (valid upload file){ $name=create local name move uploaded file to location IF (jpeg) create thumbnail } Redirect user back to index.php 8 OE NIK 2013

V 1.0 Valid file? 9 OE NIK 2013

V 1.0 Create local name 10 OE NIK 2013

V 1.0 Move file? move_uploaded_file($old_name, $new_name); move_uploaded_file($_FILES[$file]["tmp_name"], $DIR_destination.$name); 11 OE NIK 2013

V 1.0 Create Thumbnail? 12 OE NIK 2013

V 1.0 EXERCISES (OPTIONAL) Create an upload form with a checkbox and four textboxes. If the checkbox is checked, then you should draw a rectangle to the thumbnail – the rectangle's coordinates are specified in the four textboxes Write a dynamically sized copyright note to the bottom- right corner of every uploaded image (imagettfbbox?) Draw 20 random lines to the image 13 OE NIK 2013

V 1.0 OE NIK 2013 PHP+SQL 7. Directory Management GD File Uploads Exercises 14

V 1.0 Be sure to check for all possible errors/conditions in all the scripts (no input, bad input)! Direct access for HTML files is not allowed: the PHP files have to read and display the HTML files if there is no user input, and the proper output should be displayed if there is a user input. You can use xxxx.php?action=SOMETHING if you want, in this case: every PHP file will require two actions: one to display the HTML form, and another to display the output. The HTML form should POST all data to the second action. 15 OE NIK 2013

V 1.0 You should create a script to list the Fibonacci sequence. –Create a file 1_fibo.html that has a form inside: the form should have a text input, and a submit button. The form should submit all data via POST to 1_fibo.php. –Create a file 1_fibo.php that should list all elements of the Fibonacci sequence until the given number, and the script should decide if the last number is a perfect number or not. –[The first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two (0, 1, 1, 2, 3, 5, 8). A perfect number is a number that is half the sum of all of its positive divisors (including itself: ( ) / 2 = 6) ] 16 OE NIK 2013

V 1.0 Improve the calculation of the Fibonacci sequence. –Create a file 2_fibo.html that can submit a number to 2_fibo.php via POST. In addition, there should be a select input where the user can choose to use the Fibonacci file or not. –If the user doesn’t want to use the Fibonacci file, then 2_fibo.php should simply calculate all Fibonacci numbers just like in exercise 1. –If the user wants to use the file, then 2_fibo.php should use a file to store the Fibonacci sequence (2_fibo.txt: in the beginning, the file is non-existent. Later, this file will grow!) Let’s say we have N Fibonacci numbers in the file, and the user wants M Fibonacci numbers. If M<=N, then read M Fibonacci numbers from the file, and write it out for the user. If M>N, then read all Fibonacci numbers from the file, write it out to the user. Then, calculate all remaining numbers, write it out to the user, and write it into the file as well. 17 OE NIK 2013

V 1.0 Visualize the calculation of the Fibonacci sequence. –Create a file 3_fibo.html that can submit a number to 3_fibo.php via POST. In addition, there should be a radiobutton input where the user can choose to receive a JPEG or a PNG file. –In 3_fibo.php, you should create a 1000x1000 image, and on that image you should write all Fibonacci numbers as a text (up to N, where N is the number the user entered. Every Fibonacci number should be in random colour and in random position! Use imagettftext / imagestring!) –Produce a blank red image without text if there are any errors. 18 OE NIK 2013

V 1.0 Recipe book Create an application to manage a recipe book The script should have actions to manage the ingredients.txt file: the file contains one ingredient per line; create actions to list them or add a new ingredient The script should have actions to manage the recipes.txt file: the file should have the entries in the format of: RECIPE_NAME|ingredient1,ingredient2,ingredient3 There should be an action to list all recipes (and the ingredients of the recipes) in a nice-looking table There should be an action to add a new recipe: first ask the recipe name and the number of ingredients; then input the ingredients (using selects), then save into the file OE NIK

V 1.0 OE NIK

21 OE NIK 2013