Intro to Web Programming. using PHP, HTTP, CSS, and Javascript Layton Smith CSE 4000



Similar documents
Course Outline Basic Web Development

DIPLOMA IN WEBDEVELOPMENT

Certified PHP/MySQL Web Developer Course

WEB DEVELOPMENT COURSE (PHP/ MYSQL)

Modern Web Development From Angle Brackets to Web Sockets

Instructions for Embedding a Kudos Display within Your Website

Working with forms in PHP

Facebook Twitter YouTube Google Plus Website

Web development... the server side (of the force)

PHP Tutorial From beginner to master

Ajax Performance Tuning and Best Practice

Course Information Course Number: IWT 1229 Course Name: Web Development and Design Foundation

10CS73:Web Programming

Interactive Data Visualization for the Web Scott Murray

Advanced Web Development SCOPE OF WEB DEVELOPMENT INDUSTRY

CSCI110: Examination information.

MASTERTAG DEVELOPER GUIDE

Web Development using PHP (WD_PHP) Duration 1.5 months

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

Cache All The Things

GUI and Web Programming

JavaScript Testing. Beginner's Guide. Liang Yuxian Eugene. Test and debug JavaScript the easy way PUBLISHING MUMBAI BIRMINGHAM. k I I.

Cyber Security Challenge Australia 2014

Web Application diploma using.net Technology

Introduction to Server-Side Programming. Charles Liu

Modern Web Development:

jquery Tutorial for Beginners: Nothing But the Goods

Web Application Guidelines

Outline Definition of Webserver HTTP Static is no fun Software SSL. Webserver. in a nutshell. Sebastian Hollizeck. June, the 4 th 2013

Lecture 5: Java Fundamentals III

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

CS170 Lab 11 Abstract Data Types & Objects

CSC309 Winter 2016 Lecture 3. Larry Zhang

JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK

Web Programming Step by Step

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

Example. Represent this as XML

Mobile Web Design with HTML5, CSS3, JavaScript and JQuery Mobile Training BSP-2256 Length: 5 days Price: $ 2,895.00

Finding XSS in Real World

CLASSROOM WEB DESIGNING COURSE

AdFalcon Mobile Web API Integration Developer's Guide. AdFalcon Mobile Ad Network Product of Noqoush Mobile Media Group

Debugging JavaScript and CSS Using Firebug. Harman Goei CSCI 571 1/27/13

CSS 101. CSS CODE The code in a style sheet is made up of rules of the following types

Software Development Interactief Centrum voor gerichte Training en Studie Edisonweg 14c, 1821 BN Alkmaar T:

Going Beyond SAP ITS Mobile Apps to a Responsive Design Mobile Apps. JK (JayaKumar Pedapudi) Principal Consultant NTT DATA, Inc.

Web Development with R

Motivation retaining redisplaying

INTERNET PROGRAMMING AND DEVELOPMENT AEC LEA.BN Course Descriptions & Outcome Competency

Application layer Web 2.0

Fachgebiet Technische Informatik, Joachim Zumbrägel

ISI ACADEMY Web applications Programming Diploma using PHP& MySQL

Overview. In the beginning. Issues with Client Side Scripting What is JavaScript? Syntax and the Document Object Model Moving forward with JavaScript

Chatbots 3.3. Chatbots in Web Applications with RiveScript. Presented by Noah Petherbridge

Three Approaches to Web. with RPG

Introduction Les failles les plus courantes Les injections SQL. Failles Web. Maxime Arthaud. net7. Jeudi 03 avril 2014.

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

Drupal CMS for marketing sites

SUBJECT CODE : 4074 PERIODS/WEEK : 4 PERIODS/ SEMESTER : 72 CREDIT : 4 TIME SCHEDULE UNIT TOPIC PERIODS 1. INTERNET FUNDAMENTALS & HTML Test 1

WIRIS quizzes web services Getting started with PHP and Java

JavaScript: Client-Side Scripting. Chapter 6

Specialized Programme on Web Application Development using Open Source Tools

Fast track to HTML & CSS 101 (Web Design)

Chapter 22 How to send and access other web sites

Web Design Technology

Yandex.Widgets Quick start

Building a Multi-Threaded Web Server

Script Handbook for Interactive Scientific Website Building

Java with Eclipse: Setup & Getting Started

J a v a Quiz (Unit 3, Test 0 Practice)

Software documentation systems

Paging, sorting, and searching using EF Code first and MVC 3. Introduction. Installing AdventureWorksLT database. Creating the MVC 3 web application

Web Development with R

Programming the Web Server. Robert M. Dondero, Ph.D. Princeton University

The purpose of jquery is to make it much easier to use JavaScript on your website.

COURSE CONTENT FOR WINTER TRAINING ON Web Development using PHP & MySql

Short notes on webpage programming languages

COMP 112 Assignment 1: HTTP Servers

Mink Documentation. Release 1.6. Konstantin Kudryashov (everzet)

Performance Testing for Ajax Applications

Outline of CSS: Cascading Style Sheets

Using jquery and CSS to Gain Easy Wins in CiviCRM

PHP Magic Tricks: Type Juggling. PHP Magic Tricks: Type Juggling

CMSC434 TUTORIAL #3 HTML CSS JavaScript Jquery Ajax + Google AppEngine Mobile WebApp HTML5

Building Ajax Applications with GT.M and EWD. Rob Tweed M/Gateway Developments Ltd

Internet Technologies. World Wide Web (WWW) Proxy Server Network Address Translator (NAT)

php-crypto-params Documentation

Instructor: Betty O Neil

Web Designing with UI Designing

Entrance exam for PBA in Web Development

An Introduction to Developing ez Publish Extensions

Vodia PBX RESTful API (v2.0)

Testking.M Q

Programming in HTML5 with JavaScript and CSS3

PHP code audits. OSCON 2009 San José, CA, USA July 21th 2009

LAMP [Linux. Apache. MySQL. PHP] Industrial Implementations Module Description

How to Code With MooTools

PHP COOKIES, SESSIONS,

LAB4 Making Classes and Objects

Gantry Basics. Presented By: Jesse Hammil (Peanut Gallery: David Beuving)

A REST API for Arduino & the CC3000 WiFi Chip

Transcription:

Intro to Web Programming using PHP, HTTP, CSS, and Javascript Layton Smith CSE 4000

Intro Types in PHP Advanced String Manipulation The foreach construct $_REQUEST environmental variable Correction on extract and ereg Easier file access The session How to use include and require functions and scope HTTP, CSS, Javascript What does it all mean??? Debugging it all

Types in PHP Variable Types int, float, bool, string array object resource null Comparisons with ==,!=, ===,!== 1 == "1" is true 1 === "1" is false 1 === 1 is true

Why use PHP? Available nearly everywhere Very good support/documentation Plenty of tools to help Fast development Even has a GUI library!

Advanced Strings Dot (.) is concatenation (not de-reference) $string = "Hello World"; echo 'This is a \n $string'; echo "This is a \n $string"; Outputs: This is a \n $string This is a Hello World

Heredoc/Nowdoc echo <<<AnYtHiNg This expands $variables and \n newlines AnYtHiNg; echo <<<'anything' This doesn't expand $variables or \n newlines anything;

Array Handling In Java: Iterable<Clazz> i = new Iterable<Clazz>(); //... for(clazz c : i){ //i gets looped through and assigned to c at each loop } In PHP $array = array("key1" => "value1", "key2" => "value2"); foreach($array as $key => $value){ //$key is the index/key, and $value is the value }

Array Handling cont. Array constructor: $array = array("item", "key1" => 1, "key2" => "value"); $array[] = "value1"; $array[] = "value2"; //equivalent to $array = array("value1", "value2"); //or $array[0] = "value1"; $array[1] = "value2";

$_REQUEST $_REQUEST is equivalent to: array_merge($_get, $_POST, $_COOKIES); Order can be arranged in the php.ini file

DON'T USE EXTRACT ON USER INPUT! (use $_REQUEST instead) Example

Quicker file handling $file_contents_as_string = file_get_contents($filename) file_put_contents($filename, $contents_to_write)

The Session session_start() sends user PHPSESSID cookie. $_SESSION holds only this user's data First script: $_SESSION['key'] = $value; Second script: $value = $_SESSION['key'];

Includes/Requires file.php: $var = "Hello World!"; page.php: $var = "Goodbye World!"; include("file.php"); echo $var; Outputs: Hello World!

Variable Scope In Java: String s = "Hi"; if(true){ System.out.println(s); } System.out.println(s); This works fine

Variable Scope (cont.) In Java: if(true){ String a = "Hello World"; } System.out.println(a); Compile error!

Variable Scope (cont.) In PHP: $string = "Hi"; if(true){ echo $string; } Outputs: Hi

Variable Scope (cont.) In PHP: if(true){ $string = "Hi"; } echo $string; Outputs: Hi (not a syntax error!)

Variable Scope (cont.) Two scopes: Global Scope - all variables outside of a function Function Scope - only variables declared in function $a = "Hi!"; function f(){ echo isset($a)?"it is set!":"it is not set!"; } f(); Outputs: It is not set!

Variable Scope (cont.) Superglobals: $_GET, $_POST, $_SESSION, etc... always in scope. Use the global keyword $a = "Hi!"; function f(){ global $a; echo isset($a)?"it is set!":"it is not set!"; } f(); Outputs: "It is set!"

Functions In Java: class myclass{ int myfunction(int one, String two){ //do stuff } int myfunction(int one){ return myfunction(one, "default"); } } Perfectly legitimate Java code

Functions (cont.) In PHP: function myfunction($one, $two = "default"){ //do something; }

Functions (cont.) In Java: class myclass{ int myfunction(int one, boolean two){ return something; } } int myfunction(boolean two, int one){ return something; } No equivalent in PHP

HTTP Sample HTTP request POST /index.php HTTP/1.1 Host: example.com Content-Type: application/x-www-form-urlencoded key1=value1&key2=value%20of%20key2

HTTP (cont.) Sample HTTP Response HTTP/1.1 200 OK Date: Mon, 07 Mar 2011 21:05:05 GMT Content-Type: text/html Content-Length: x <html>...</html> Example in BurpSuite

CSS Cascading Style Sheets Order of priority: 3. <link href="special.css" rel="stylesheet" type="text/css" /> 2. <style type="text/css">...</style> 1. <div style='background-color: red;'></div>

CSS (cont.) Selectors: E - element E #id - element with id='id'.class - element with class='class' E > F - element F that is child of E E F - element F that is descendant of E div.red { color: red; }

CSS (cont.) Syntax: <selector> { <property>:<value>; }

Javascript Client Side Scripting Server forms the html Javascript manipulates that html AJAX used to communicate Install JQuery, and use it

PHP + HTTP + CSS + Javascript

Debugging everything Use Firebug/Chrome Developer Tools See all parts of the HTTP transaction Debug Javascript Edit HTML realtime Watch GET/POST requests live Example

Sources php.net - PHPs equivalent to Java API w3schools.com - Javascript/CSS/HTML reference jquery.com - Javascript wrapper library portswigger.net/burp/ - BurpSuite http://getfirebug.com/ - Firebug for Firefox