Website Development Basics with PHP MySQL

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

Creating WordPress Websites. Creating a site on your computer Local server Local WordPress installation Setting Up Dreamweaver.
1 CS428 Web Engineering Lecture 23 MySQL Basics (PHP - VI)
Web Page A page displayed by the browser. Website Collection of multiple web pages Web Browser: A software that displays web pages on client computer.
SJSU CS157B Dr. Lee1  2004 Jenny Mitchell Two Useful Tools You Can’t Live Without by Jenny Mitchell SJSU CS157B Section PHP and MySQL.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
Institute of New Media Development & Research Prabhat Road, Lane No 5, Opp. Lijit Papad, Above OBC Bank, 1st Floor, Pune Web site :
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
Server-side Scripting Powering the webs favourite services.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
JavaScript – Quiz #9 Lecture Code:
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
NMD202 Web Scripting Week3. What we will cover today Includes Exercises PHP Forms Exercises Server side validation Exercises.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
1 DIG 3134 – Lecture 14 MySQL and PHP Play Together Michael Moshell University of Central Florida Media Software Design.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
PHP “Personal Home Page Hypertext Pre-processor” (a recursive acronym) Allows you to create dynamic web pages and link web pages to a database.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class Three Instructor:
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
MySQL MySQL and PHP – interacting with a database.
CGS 3066: Web Programming and Design Spring 2016 Introduction to Server-Side Programming.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
PHP stands for …….. “PHP Hypertext Pre-processor” and is a server-side scripting language like ASP. PHP scripts are executed on the server PHP supports.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
Presented By Sushil K. Chaturvedi Assistant Professor SRCEM,Banmore 1.
PHP using MySQL Database for Web Development (part II)
CGS 3066: Web Programming and Design Spring 2017
Introduction and HTML overview
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Chapter 5 Scripting Language
CSC 301 Web Programming Charles Frank.
Introduction to Web programming
Database application MySQL Database and PhpMyAdmin
Introduction to Web programming
PHP & MySQL Introduction.
Chapter 5 Scripting Language
PHP / MySQL Introduction
BASIC PHP and MYSQL Edward S. Flores.
PHP Introduction.
PHP Overview PHP: Hypertext Preprocessor Server-Side Scripting
Database Driven Websites
ISC440: Web Programming 2 Server-side Scripting PHP 3
Web Systems Development (CSC-215)
Developing a Model-View-Controller Component for Joomla Part 3
Lecture 2 - SQL Injection
PHP and Forms.
Server-Side Processing II
IntroductionToPHP Static vs. Dynamic websites
Intro to PHP.
Tutorial 6 PHP & MySQL Li Xu
PHP Forms and Databases.
PHP an introduction.
PHP By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and.
Web Application Development Using PHP
Presentation transcript:

Website Development Basics with PHP MySQL CMP283 Database Management Sabahattin Gokhan Ozden www.gokhanozden.com April 18, 2017

Learning Outcomes How to setup a PHP MySQL development environment on a computer How to create database using PHPMyAdmin. How to create tables using PHPMyAdmin. How to add records using PHPMyAdmin. How to create a simple PHP page to show records. How to modify the page so it shows certain records using GET method. How to create a simple form to add records to database using POST method. How to update those records.

What Not to Expect from This Class Website Design Basics (Photoshop, CSS, etc.) Search Engine Optimization Database Modeling (Normalization, Primary Key, JOINs, etc.)

Agenda PHP (php.net) MySQL (mysql.com) Environment Setup (WinLAMP- Windows, MAMP – MacOS, Windows) PhpMyAdmin (comes with WinLAMP) Web Based Personal Address Book (http://www.hosting.vt.edu/tutorials/phpmysql/) Database Design of the System Accessing and Manipulating Data with PHP http://winlamp.sourceforge.net/ mamp.info/

PHP PHP stands for “Personal Home Page” Server side scripting language designed for web development Created by Rasmus Lerdorf in 1994 It can be embedded into HTML or HTML5 The code is processed by a PHP interpreter <? echo “Hello World”; ?> <!DOCTYPE html> <html> <head> <title>First PHP</title> </head> <body><?php echo '<p>Hello World</p>'; ?></body> </html>

MySQL Open source relational database management system LAMP (Linux, Apache, MySQL, Perl/PHP/Python), WAMP (Windows), MAMP (MacOS) Used by WordPress, phpBB, Drupal, Joomla, Google (not for search), Facebook, Twitter, Flickr, Youtube, Verizon.

PHP MySQL Source: wikipedia.org

Let’s Practice http://tutorialspoint.com/php_mysql_online.php

Variables <?php $a = 1; $b = 2; // add two values and output the result echo $a+$b; ?>

IF Statements <?php $age = 18; $inUSA = true; if ($age < 21 && $inUSA) { echo "Sorry, you can't drink in the US.<br>"; echo "How about a trip to Europe?"; } ?>

IF Statements (Exercise) Legal age calculator You input your age and it tells you what you can and you can’t do with respect to legal driving age (16), voting age (18), and legal drinking age (21). For example if you enter 17 it will output: You can drive legally. You can’t vote. You can’t drink legally.

Loops <?php for ($number=1; $number <= 1000; $number++) { echo $number," "; if ($number/2 == floor($number/2)) { echo "even"; } else { echo "odd"; } echo "<br>"; } ?>

Loops (Exercise) Calculate the summation of numbers from 1 to 10 Hint: Summation should be equal to 55

Loops (Exercise) – A solution <?php // for loop $n = 10; $sum = 0; // sum of n natural numbers for ($i = 1;$i <= $n;$i++) { $sum+= $i; } echo ($sum); ?>

PHPMyAdmin Open source GUI written in PHP to design and manipulate databases in MySQL. Create, modify, delete databases, tables, fields, or rows, manage users and permissions in a web browser.

GET vs. POST methods Source: https://www.w3schools.com/tags/ref_httpmethods.asp

SQL Injection SQL Injection is an injection attack where an attacker can execute malicious SQL statements that control a web application’s database server. Attacker can bypass web application’s authentication and authorization mechanisms. Attacker can retrieve the contents of an entire database. Attacker can add, modify, and delete records. More info: https://www.acunetix.com/websitesecurity/sql-injection/

An Address Book

Five PHP Scripts dbconnect.php (Connects to the database) listcontacts.php (queries the database for all names, outputs a table with all data including edit and delete links which contain the record-ID as a parameter, the delete link is intercepted by a JavaScript confirmation message) addcontact.php (Has an input form, it submits to itself, validates if first name or last name empty, if data is complete then it is added to database) editcontact.php (Very similar to addcontact.php, but the form is prefilled with the data already in database, gets the unique record with the “$id” variable which is passed to it by the edit link in listcontacts.php, when the form is submitted it validates and updates the record instead of inserting a new one. deletecontact.php (this does not have a visible HTML page, it gets the record id from listcontacts.php and deletes the record and returns back to listcontacts.php) These scripts can be download from http://www.gokhanozden.com/guest-lecturer-at-chatham- university/