NMD202 Web Scripting Week3. What we will cover today Includes Exercises PHP Forms Exercises Server side validation Exercises.

Slides:



Advertisements
Similar presentations
PHP Form and File Handling
Advertisements

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 3 MORE ON FORM HANDLING INCLUDING MULTIPLE FILES WRITING FUNCTIONS.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
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.
NMD202 Web Scripting Week5. What we will cover today PHPmyAdmin Debugging – using print_r Modifying Data PHP (cont.) 4D Methodology File and IO operations.
By Brian Vees.  SQL Injection  Username Enumeration  Cross Site Scripting (XSS)  Remote Code Execution  String Formatting Vulnerabilities.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
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.
Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.
PHP Tutorials 02 Olarik Surinta Management Information System Faculty of Informatics.
PHP Security.
Advance web Programming Chapter 3: MySQL Date: 28 April 2014 Advance web Programming Chapter 3: MySQL Date: 28 April 2014 Dr. Mogeeb A. A. Mosleh .
Web forms in PHP Forms Recap  Way of allowing user interaction  Allows users to input data that can then be processed by a program / stored in a back-end.
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
JavaScript Form Validation
1 Chapter 6 – Creating Web Forms and Validating User Input spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Form Handling.
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.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Lecture 7 – Form processing (Part 2) SFDV3011 – Advanced Web Development 1.
Internet and Web Application Development Revision.
PHP Hypertext PreProcessor. Documentation Available SAMS books O’Reilly Books.
CSCI 6962: Server-side Design and Programming Secure Web Programming.
Week 7. Lecture 3 PHP Forms. PHP forms In part 2 of this course, we discussed html forms, php form is similar. Lets do a quick recap of the things we.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Week seven CIT 354 Internet II. 2 Objectives Database_Driven User Authentication Using Cookies Session Basics Summary Homework and Project 2.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
PHP Workshop ‹#› PHP Security. PHP Workshop ‹#› Two Golden Rules 1.FILTER external input Obvious.. $_POST, $_COOKIE, etc. Less obvious.. $_SERVER 2.ESCAPE.
Website Development with PHP and MySQL Saving Data.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
PHP2. PHP Form Handling The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. Name: Age:
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
Prof Frankl, Spring 2008CS Polytechnic University 1 Overview of Web database applications with PHP.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
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.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflows can be triggered by inputs that are designed to execute code, or alter the way the program.
SecurityPHPApril 2010 : [‹#›] PHP Security. SecurityPHPApril 2010 : [‹#›] Two Golden Rules 1.FILTER external input Obvious.. $_POST, $_COOKIE, etc. Less.
Introduction to JavaScript CS101 Introduction to Computing.
Server-Side Scripting with PHP ISYS 475. PHP Manual Website
ITM © Port, Kazman1 ITM 352 More on Forms Processing.
>> PHP: Insert Query & Form Processing. Insert Query Step 1: Define Form Variables Step 2: Make DB Connection Step 3: Error Handling Step 4: Define the.
Part 2 Lecture 9 PHP Superglobals and Form Handling.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
Form Handling IDIA 618 Fall 2014 Bridget M. Blodgett.
PHP Error Handling & Reporting. Error Handling Never allow a default error message or error number returned by the mysql_error() and mysql_errno() functions.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflow Analysis of Buffer Overflow Attacks.
 2001 Prentice Hall, Inc. All rights reserved. Chapter 7 - Introduction to Common Gateway Interface (CGI) Outline 7.1Introduction 7.2A Simple HTTP Transaction.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Since you’ll need a place for the user to enter a search query. Every form must have these basic components: – The submission type defined with the method.
ASSIGNMENT POINTS DUE DATE: Monday NOV 30 JAVASCRIPT, INPUT VALIDATION, REGEX See 2 nd slide for Form See 3 rd next slide for the required features.
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.
NMD202 Web Scripting Week2. Web site
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
PHP and SQL Server: Connection IST 210: Organization of Data IST2101.
1 Week 8 Final Project Planning & Chapter 6 JavaScript Advanced Web Development IT225 Spring Term 2016 Marymount University School of Business Administration.
Simple PHP Web Applications Server Environment
Receiving form Variables
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Website Development Basics with PHP MySQL
Web Programming– UFCFB Lecture 17
Lecture 2 - SQL Injection
PHP Forms and Databases.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2016 Section DA MW 4:05-5:20
Presentation transcript:

NMD202 Web Scripting Week3

What we will cover today Includes Exercises PHP Forms Exercises Server side validation Exercises

Includes The include($filename) statement includes and evaluates the specified file. require($filename), does the same thing except it halt execution if $filename is not found include_once($filename), require_once($filename), file is included only once if called several times

Includes Security Considerations: PHP Injection – Technique that exploits Vulnerabilities that allows attacker to include files with malicious code

Exercises Redo last exercise (student table) but split your file into logical sections (templating), ie:Include the head of your document, the body, the footer, etc. Place the stud array (model) in an external file and include it in the main script.

PHP forms When using forms, some sort of server side scripting is needed to handle the submitted data. Basically All form elements and data submitted through them will be available on the server to be manipulated

PHP forms 2 Different Methods to submit data: Get: Uses the querystring to submit the data Post: Uses the post method of the HTTP protocol to submit data

PHP forms Get: should be used when page after form submission needs to be bookmarked Post: Should be used when information to submit is huge or sensitive

PHP forms All info submitted in the form is either available in the $_GET or $_Post Superglobals depending on the method used. Entries in the superglobal array will match the attribute “name” in the form elements

Exercises Redo the student exercise using a form to input the filter instead of the querystring, use the post method. After applying filter (form submission)make sure form retains the entry for usability purposes. Tip: Check the $_POST if it contains data, if empty display all table, if not apply the filter.

Includes Security Considerations: Register Globals – All entries in $_GET and $_POST are automatically extracted into variables. Relying on this feature is highly discouraged.

PHP forms Security Considerations : (bypass authentication by making bad use of register globals) <?php // define $authorized = true only if user is authenticated if (authenticated_user()) { $authorized = true; } // Because we didn't first initialize $authorized as false, this might be // defined through register_globals, like from GET auth.php?authorized=1 // So, anyone can be seen as authenticated! if ($authorized) { include "/highly/sensitive/data.php"; } ?>

PHP forms Validation Data validation should always be used with submitted data: -Security reasons -Data quality System should never rely just on client side validation (usability enhancer)

PHP forms Validation Data validation should always be used with submitted data: -Security reasons -Data quality System should never rely just on client side validation (Client side to be used just as a usability enhancer)

PHP forms Validation Validation procedure to check validity Data Data is valid – Proceed (Insert database, perform some action) and display feedback Data is not valid – Do not proceed, Present the form (entries pre-filled with submitted data, except password fields) and feedback providing info on which fields validation failed

PHP forms Validation <?php function dataValidates(){ //logic validation here; //return true/false; } $valid = false; if (form has been submitted) { $valid = dataValidates(); } if ($valid) { //Do some background action here (submit data Database, send , etc) } ?>..... <?php if ($valid){ //display html for valid data submitted (Feedback) } else{ //display html for invalid data submitted (Warning messages) } ?>

Exercises Build a form to submit data about a user registration: First Name, Last Name, , password, Confirm password. Make all fields required, must be a valid (check for symbol) and passwords must match. If info is valid display a table with all the details and hide the form field. If not display the form field with error messages next to the appropriate elements