Web Focused Programming With PHP

Similar documents
Starting To Write PHP Code

PHP Wrap Up. Thomas Beebe Advanced DataTools Corp

Jquery Ajax Json Php Mysql Data Entry Example

Form Processing in PHP

Dreamweaver: Web Forms

Attacks Against Websites 3 The OWASP Top 10. Tom Chothia Computer Security, Lecture 14

External HTML E-form Guide

The HTTP Protocol HTTP

Attacks Against Websites. Tom Chothia Computer Security, Lecture 11

Master Syndication Gateway V2. User's Manual. Copyright Bontrager Connection LLC

Lecture : 3. Practical : 2. Course Credit. Tutorial : 0. Total : 5. Course Learning Outcomes

UNIT-VI CREATING AND USING FORMS

PHP with MySQL: What you need to know Chapter 3. This section is on using PHP script tags appropriately in your PHP program.

Manual Html A Href Onclick Submit Form

USQ/CSC2406 Web Publishing

NETB 329 Lecture 13 Python CGI Programming

First Simple Interactive JSP example

Autopopulation; Session & Cookies

Creating an Online Catalogue Search for CD Collection with AJAX, XML, and PHP Using a Relational Database Server on WAMP/LAMP Server

Informix Client/Server Encryption

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

CGI Programming. What is "CGI"?

Standard 1 The student will author web pages using the HyperText Markup Language (HTML)

Princess Nourah bint Abdulrahman University. Computer Sciences Department

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

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

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

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

cwhois Manual Copyright Vibralogix. All rights reserved.

Mul$media im Netz (Online Mul$media) Wintersemester 2014/15. Übung 06 (Haup-ach)

Task 1: JavaScript Video Event Handlers

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

Web Programming. Based on Notes by D. Hollinger Also Java Network Programming and Distributed Computing, Chs.. 9,10 Also Online Java Tutorial, Sun.

PYTHON CGI PROGRAMMING

1. Begin by selecting [Content] > [Add Content] > [Webform] in the administrative toolbar. A new Webform page should appear.

Alpha College of Engineering and Technology. Question Bank

HTML Forms. By Jaroslav Mohapl

ABSOLUTE FORM PROCESSOR ADMINISTRATION OPTIONS

Lecture 17 Browser Security. Stephen Checkoway University of Illinois at Chicago CS 487 Fall 2017 Some slides from Bailey's ECE 422

Lecture 6: More Arrays & HTML Forms. CS 383 Web Development II Monday, February 12, 2018

welcome to BOILERCAMP HOW TO WEB DEV

BF Survey Pro User Guide

20486-Developing ASP.NET MVC 4 Web Applications

Chapter4: HTML Table and Script page, HTML5 new forms. Asst. Prof. Dr. Supakit Nootyaskool Information Technology, KMITL

Developing Ajax Applications using EWD and Python. Tutorial: Part 2

Lab 4: Basic PHP Tutorial, Part 2

Princess Nourah bint Abdulrahman University. Computer Sciences Department

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

JavaScript Specialist v2.0 Exam 1D0-735

Task 1: JavaScript Video Event Handlers

ITEC447 Web Projects CHAPTER 9 FORMS 1

Welcome. Web Authoring: HTML - Advanced Topics & Photo Optimisation (Level 3) Richard Hey & Barny Baggs

PHP. MIT 6.470, IAP 2010 Yafim Landa

CS Final Exam Review Suggestions - Spring 2018

c360 Web Connect Configuration Guide Microsoft Dynamics CRM 2011 compatible c360 Solutions, Inc. c360 Solutions

Assignment, part 2. Statement and concepts INFO-0010

Servlets by Example. Joe Howse 7 June 2011

DAY 2. Creating Forms

User authentication, passwords

Forms, CGI. Objectives

Open Source Digitalization Application. Installation Manual

HTML Forms & PHP. Database Systems CSCI Dr. Tom Hicks Computer Science Department

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

last time: command injection

Static Webpage Development

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

CSC 309 The Big Picture

Software. Full Stack Web Development Intensive, Fall Lecture Topics. Class Sessions. Grading

Contents. Acknowledgments

Settings for UPlan PC Users

OO and Ahh! An Introduction to Object Oriented Programming With PHP. Division 1 Systems. John Valance. Copyright John Valance Division 1 Systems

Database Systems Fundamentals

Overview of Forms. Forms are used all over the Web to: Types of forms: Accept information Provide interactivity

Get in Touch Module 1 - Core PHP XHTML

Javascript Lecture 23

Computer Science Department

Working Bootstrap Contact form with PHP and AJAX

Create-A-Page Design Documentation

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


Web Development & SEO (Summer Training Program) 4 Weeks/30 Days

CSCE 813 Internet Security Case Study II: XSS

Creating and Building Websites

Web Security. Jace Baker, Nick Ramos, Hugo Espiritu, Andrew Le

Financial. AngularJS. AngularJS.

Makbul Khan. Nikhil Sukul

CS50 Quiz Review. November 13, 2017

Dynamic Form Processing Tool Version 5.0 November 2014

Financial. AngularJS. AngularJS. Download Full Version :

This is CS50. Harvard College Fall Quiz 1 Answer Key

Penetration Testing. James Walden Northern Kentucky University

Detects Potential Problems. Customizable Data Columns. Support for International Characters

Submitting forms (client-side)

How to Create a NetBeans PHP Project

Last &me: Javascript (forms and func&ons)

CS105 Perl: Perl CGI. Nathan Clement 24 Feb 2014

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

Spring 2014 Interim. HTML forms

Web Security: Vulnerabilities & Attacks

Transcription:

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 10 years. He has been working with Informix since college and is currently the lead consultant for Networking, Unix System Administration and Web Development. Tom is Project Manager and lead developer on a variety of Web Development projects. Contact Info: tom@advancedatatools.com www.advancedatatools.com 703-256-0267 x 106 2

About This Webcast Series Four Webcasts: March 18 th Getting started April 22 nd Data structures, objects, functions and database access. May 20 th Introduction to web focused programming. Creating simple and advanced forms June 17 th Putting it all together, assorted advanced topics. Make sure to register for them

Schedule How does the tech actually work Writing simple web code What are forms, how do they work $_GET, $_POST, $_REQUEST, $_FILE Building PHP forms Connecting it to Informix $_SESSION Next Steps

How Does A Web Call Work Browser makes a request 'get /index.html' Web server looks for the file in the web directory Returns a status code 2xx Success 3xx Redirect 4xx Error 5xx Server Error If it is a 200 it will read and send the index.html file and send it along Browser receives the HTML code and starts rendering it top down Follows and loads any links (js, css, etc) in order they are seen Displays the page

Path Of A Web Script Browser sends a request Get Returns status code 200 it will process Reads in the PHP code into memory. Compiles and executes the PHP code and merges it into the code. HTML code will be handled like.html files The executed code will be brought into apache memory Streamed the processed code out to the browser Browser displays the code

Basic Web Code <html><head></head><body> <p>the value of X is: <?php echo $x;?></p> </body></html>

Templating Web Code $line = <html><head></head><body> The value of X is: $x </body></html> ; print $line ;

Browser Vs Server Server code (PHP) is processed at time of execution. Once the page has been sent it is finished running. Once it is on the browser you need a browser based language to make anything happen. (Javascript, jquery, etc)

Forms Forms are embedded in HTML Input Types: Text Textarea Radio Checkbox Select Submit Button Hidden File

Forms Starts with <form> and ends with </form> Parameters method (post/get) Action (target of submission) Submit call sends it Each form field has to be uniquely named Two exceptions Radio Buttons Array of values (often checkboxes) use [] on the name

What Actually Happens Browser requests webpage with form Sends it back over, displays in browser Filled out by user, submit is pressed Data is sent to the server along with a request for the target page (action attribute) Server runs code, sends the new page Code does whatever you tell it to with the submitted data

Get vs Post Get passes data via URL line Must use urlencode to pass it cleanly Limit to length (around 2000 characters) Cannot pass binary data Will cleanly allow back and aid in browsing Post passes in a binary way Can pass files Don't need to urlencode Back will not work

Handling Data $_POST handles post data $_GET handles get data $_REQUEST gets both $_FILE manages passed files All are associated arrays $user_id = $_REQUEST['user_id'];

Handling Form Data Use the right handler Do not trust anything from your form, sanitize everything Just available anywhere in the script It is that simple

Sample <form action='test.html' method='post'> <input type='text' size='20' name='first_name'> <select name='state'> <option value='va'>virginia</option> <option value='md'>maryland</option> </select> <input type='submit' value='submit Form'> </form>

Use It With Informix $first_name = $_REQUEST['first_name']; $last_name = $_REQUEST['last_name']; $sqlline = insert into users (first_name, last_name) values (?,?) ; $sth = $dbh->prepare($sqlline); $sth->execute(array($first_name, $last_name));

$_SESSION Maintains variables for a user across web page visits Stores a cookie on the user browser Matching file in the temp directory Temp file stores session variables Global $_SESSION variable Functions to make it work: session_name('name'); session_start();

Example l l l session_name('test_session'); session_start(); $_SESSION['first_name'] = $_REQUEST['first_name']; l print First Name:. $_SESSION['first_name'];

Where To Go From Here Javascript/Jquery What is AJAX Database session storage CSS

Links http://www.php.net http://framework.zend.com/ http://www.zend.com/ http://www.iiug.org/opensource http://pecl.php.net/package/pdo_informix http://pecl.php.net/package/pdo_ibm http://www.openadmintool.org

Web Focused Programming With PHP May 20 2014 Thomas Beebe Advanced DataTools Corp (tom@advancedatatools.com)