Chapters 10 & 11 PHP AND MYSQL

Size: px
Start display at page:

Download "Chapters 10 & 11 PHP AND MYSQL"

Transcription

1 Chapters 10 & 11 PHP AND MYSQL

2 Getting Started The database for a Web app would be created before accessing it from the web. Complete the design and create the tables independently. Use phpmyadmin, for example:

3 Connecting to a Database PHP offers three different ways to connect to and interact with a MySQL database: 1. Original MySQL extension no longer developed, not recommended 2. MySQL Improved: MySQLi designed specifically for MySQL, so is not easily portable to other databases Procedural implementation (functions) Objects implementation Works for PHP versions < PHP Data Objects: PDO software neutral, preferable if database flexibility is important. We will focus on PDO

4 Communicating to the MySQL Database All PHP implementations follow the same sequence: 1. Connect to the MySQL database using the hostname, username, password, and database name. 2. Prepare an SQL query. 3. Execute the query and save the result. 4. Extract the data from the result or confirm the result. 5. Close the connection to the database.

5 The Connection File <?php /*This file contains the database access information. It should be called pdo_connect.php or something similar*/ // Set the database access information as constants using your DB credentials where indicated: define(dbconnstring,'mysql:host= ;dbname='yourdb'); define(dbuser, 'yourusername'); define(dbpass, 'yoursqlpassword');

6 Saving the Connection File Important security measure: 1. Place the pdo_connect.php file outside of the public_html directory. 2. Set file permissions on pdo_connect.php to 644.

7 Connecting to the Database using PDO PDO throws an exception if the connection fails. In development, we need to know the details of the exception In production, we would change the catch block to redirect to a generic error page. Wrap the code in a try catch block and use the constants you defined: try { $conn= new PDO(DBCONNSTRING, DBUSER, DBPASS); } catch (PDOException $e) { } echo $e->getmessage(); //for development only //for deployment (we will learn about the header function soon): // header("location:

8 Calling the Connection/Config File Use '../' to go up one level in your folder structure to reference the pdo_connect.php file. Use as many../ as needed. Use the require_once() function, which will halt the script if it is unsuccessful, to connect to the database: <?php require_once ('../pdo_connect.php');?>

9 The Query Write the SQL query as a PHP string Assign it to a PHP variable. Some things to remember: SQL keywords are not case-sensitive; using all caps is conventional to aid readability Database table names and column names are casesensitive SQL strings must be in quotes (either single or double as long as they match) SQL numeric values are not enclosed in quotes

10 Creating SQL Queries with PHP Assign the SQL query as a string to a PHP variable. (When possible, test the query first in phpmyadmin to cut down on errors.) $sql = "INSERT INTO JJ_contacts (firstname, lastname, addr, comments, newsletter) VALUES ('$firstname', '$lastname', '$ ', '$comments', $howhear)"; Remember that SQL variables are case-sensitive you must reference them exactly as they are in the database (SQL keywords are not case-sensitive.) The semicolon ends the PHP string. It isn't required for the SQL in this case.

11 Executing Queries with PDO Execute the query by calling the query() method on the connection object (which was assigned in the php_config file) and passing the query string. Assign the result to a new variable: $result = $conn->query($sql); For simple queries like, INSERT, UPDATE, DELETE, etc. (which don't return records), the function will return either TRUE or FALSE. The exec() method can also be used for simple queries. It returns the number of rows affected. For complex queries like SELECT, which return results of the query as a table, $result will be a pointer to the returned table or FALSE if it did not work.

12 PDO Errors The third element of this array is only created if something went wrong, so that is where to check for errors.

13 Checking SELECT Queries for Errors To determine if there was a problem with the query, check the third element in the array of error messages from the database which will be in the connection object's errorinfo() method: $errorinfo = $conn->errorinfo(); if (isset($errorinfo[2])) echo $errorinfo[2]; else $numrows = $result->rowcount(); Note that $errorinfo[2] is not necessarily the output you want your users to see. Change it to something more general before deployment.

14 Processing SELECT Queries It is not necessary to count the number of rows in the result table, but the rowcount() method of the $result object will have it if needed: $numrows = $result->rowcount(); A foreach loop can handle processing for all rows: <?php foreach ($conn->query($sql) as $row) {?> <tr> <td><?php echo $row['image_id'];?></td> <td><?php echo $row['filename'];?></td> <td><?php echo $row['caption'];?></td> </tr> <?php } //endforeach loop?>

15 Processing SELECT Queries Where do the $row array key values come from? <?php foreach ($conn->query($sql) as $row) {?> <tr> <td><?php echo $row['image_id'];?></td> <td><?php echo $row['filename'];?></td> <td><?php echo $row['caption'];?></td> </tr> <?php } //endforeach loop?>

16 More Specific SELECT Queries $sql = 'SELECT filename, caption FROM JJ_images WHERE image_id=6'; $sql = 'SELECT filename, caption FROM JJ_images WHERE caption LIKE "%Kyoto%"'; $sql = 'SELECT filename, caption FROM JJ_images WHERE caption LIKE BINARY "%maiko%"'; String search using LIKE comparison operator and wildcard character % Case-sensitive string comparison

17 SQL Injection SELECT * FROM users WHERE username='abc' AND pw='123' SELECT * FROM users WHERE username='abc' AND pw='123' OR 1=1 When the query is derived from a variable or from user input, it is critical to process the query safely: 1. Check that expected values are the correct type e.g. is_numeric() 2. Escape user input 3. Use prepared statements

18 Numeric User Input in a Query

19 Numeric User Input in a Query

20 Numeric User Input in a Query

21 User Registration

22 Inserting User Input to the Database SQL Name Field

23 Inserting User Input to the Database In the self-processing form, once the user s submission is acceptable, the data can be sent to the database.

24 Inserting User Input to the Database tinyint Re-work the handling of subscribe $sql = "INSERT into JJ_contacts (firstname, lastname, addr, comments, newsletter) VALUES ('$firstname', '$lastname', '$ ', '$comments', $subscribe)"; No quotes for an integer variable

25 Prepared Statements Important security features A template of an SQL query Uses placeholders for each variable Prevents SQL injection attacks: quotes and other characters are automatically escaped before the query is executed More efficient when the same query is used more than once Binding the results from each column makes output easier to display

26 Prepared Statements Both MySQLi and PDO use question marks as anonymous placeholders for column values. The execution is the same: 1. Initialize the statement 2. Prepare the statement 3. Bind values to the placeholders 4. Execute the statement 5. Bind the results (optional) 6. Store the results (optional) 7. Fetch the result 8. Close the statement to free the memory used.

27 Prepared Statements Instead of: Prepare, Bind, Execute:

28 Prepared Statements An advantage of PDO is that it allows for named placeholders:

29 Close the existing connection $statement->closecursor(); Optional because PHP will close the connection at the end of the script Makes for good programming form anyway

30 PDO Connection Crib Sheet

31 Some methods of the PDO class prepare($sql_statement) lastinsertid() Some methods of the PDOStatement class bindvalue($param, $value) execute() fetchall() fetch() rowcount() closecursor()

A Crash Course in PDO

A Crash Course in PDO PDO (PHP Data Objects) provides a vendor-neutral method of accessing a database through PHP. This means that, once you have established a connection to the specific database, the methods used to access

More information

Professional PHP for working with MySQL

Professional PHP for working with MySQL Chapter 19 Professional PHP for working with MySQL PDO (PHP Data Objects) Pros Is included with PHP 5.1 and later and available for 5.0. Provides an object-oriented interface. Provides a consistent interface

More information

CHAPTER 10. Connecting to Databases within PHP

CHAPTER 10. Connecting to Databases within PHP CHAPTER 10 Connecting to Databases within PHP CHAPTER OBJECTIVES Get a connection to a MySQL database from within PHP Use a particular database Send a query to the database Parse the query results Check

More information

COMP284 Scripting Languages Lecture 13: PHP (Part 5) Handouts

COMP284 Scripting Languages Lecture 13: PHP (Part 5) Handouts COMP284 Scripting Languages Lecture 13: PHP (Part 5) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

More information

Lecture 13: MySQL and PHP. Monday, March 26, 2018

Lecture 13: MySQL and PHP. Monday, March 26, 2018 Lecture 13: MySQL and PHP Monday, March 26, 2018 MySQL The Old Way In older versions of PHP, we typically used functions that started with mysql_ that did not belong to a class For example: o o o o mysql_connect()

More information

Systems Programming & Scripting

Systems Programming & Scripting Systems Programming & Scripting Lecture 19: Database Support Sys Prog & Scripting - HW Univ 1 Typical Structure of a Web Application Client Internet Web Server Application Server Database Server Third

More information

Networks and Web for Health Informatics (HINF 6220) Tutorial 13 : PHP 29 Oct 2015

Networks and Web for Health Informatics (HINF 6220) Tutorial 13 : PHP 29 Oct 2015 Networks and Web for Health Informatics (HINF 6220) Tutorial 13 : PHP 29 Oct 2015 PHP Arrays o Arrays are single variables that store multiple values at the same time! o Consider having a list of values

More information

Options. Real SQL Programming 1. Stored Procedures. Embedded SQL

Options. Real SQL Programming 1. Stored Procedures. Embedded SQL Real 1 Options We have seen only how SQL is used at the generic query interface an environment where we sit at a terminal and ask queries of a database. Reality is almost always different: conventional

More information

Development Technologies. Agenda: phpmyadmin 2/20/2016. phpmyadmin MySQLi. Before you can put your data into a table, that table should exist.

Development Technologies. Agenda: phpmyadmin 2/20/2016. phpmyadmin MySQLi. Before you can put your data into a table, that table should exist. CIT 736: Internet and Web Development Technologies Lecture 10 Dr. Lupiana, DM FCIM, Institute of Finance Management Semester 1, 2016 Agenda: phpmyadmin MySQLi phpmyadmin Before you can put your data into

More information

LAB 11 WORKING WITH DATABASES

LAB 11 WORKING WITH DATABASES LAB 11 WORKING WITH DATABASES What You Will Learn How to install and manage a MySQL database How to use SQL queries in you PHP code How to integrate user inputs into SQL queries How to manage files inside

More information

Using PHP with MYSQL

Using PHP with MYSQL Using PHP with MYSQL PHP & MYSQL So far you've learned the theory behind relational databases and worked directly with MySQL through the mysql command-line tool. Now it's time to get your PHP scripts talking

More information

CPET 499/ITC 250 Web Systems

CPET 499/ITC 250 Web Systems CPET 499/ITC 250 Web Systems Chapter 11 Working with Databases Part 2 of 3 Text Book: * Fundamentals of Web Development, 2015, by Randy Connolly and Ricardo Hoar, published by Pearson Paul I-Hai, Professor

More information

OpenEMR ZF2 Module Installer. 1. Authentication to Database and SQL Query Handling. 1.1 Zend\Db\Adapter. Introduction

OpenEMR ZF2 Module Installer. 1. Authentication to Database and SQL Query Handling. 1.1 Zend\Db\Adapter. Introduction 1. Authentication to Database and SQL Query Handling 1.1 Zend\Db\Adapter The Adapter object is the most important sub-component of Zend\Db. It is responsible for adapting any code written in or for Zend\Db

More information

Managing Multiple Database Tables

Managing Multiple Database Tables Chapter 16 Managing Multiple Database Tables The previous chapter showed you how to use INNER JOIN and LEFT JOIN to retrieve information stored in multiple tables. You also learned how to link existing

More information

How to use PHP with a MySQL database

How to use PHP with a MySQL database Chapter 4 How to use PHP with a MySQL database The syntax for creating an object from any class new ClassName(arguments); The syntax for creating a database object from the PDO class new PDO($dsn, $username,

More information

escuela técnica superior de ingeniería informática

escuela técnica superior de ingeniería informática Tiempo: 2h escuela técnica superior de ingeniería informática Versión original: José Antonio Parejo y Manuel Resinas (diciembre 2008) Última revisión: Amador Durán y David Benavides (diciembre 2006); revisión

More information

PHP Development - Introduction

PHP Development - Introduction PHP Development - Introduction Php Hypertext Processor PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports many

More information

Web Systems Nov. 2, 2017

Web Systems Nov. 2, 2017 Web Systems Nov. 2, 2017 Topics of Discussion Using MySQL as a Calculator Command Line: Create a Database, a Table, Insert Values into Table, Query Database Using PhP API to Interact with MySQL o Check_connection.php

More information

Executing Simple Queries

Executing Simple Queries Script 8.3 The registration script adds a record to the database by running an INSERT query. 1

More information

Chapter 7 PHP Files & MySQL Databases

Chapter 7 PHP Files & MySQL Databases Chapter 7 PHP Files & MySQL Databases At the end of the previous chapter, a simple calendar was displayed with an appointment. This demonstrated again how forms can be used to pass data from one page to

More information

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. magic_quotes_runtime = Off

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. magic_quotes_runtime = Off SQLite PHP tutorial This is a PHP programming tutorial for the SQLite database. It covers the basics of SQLite programming with PHP language. There are two ways to code PHP scripts with SQLite library.

More information

SQL Injection Attack Lab

SQL Injection Attack Lab SEED Labs SQL Injection Attack Lab 1 SQL Injection Attack Lab Copyright 2006-2016 Wenliang Du, Syracuse University. The development of this document was partially funded by the National Science Foundation

More information

CSE 127: Computer Security SQL Injection. Vector Li

CSE 127: Computer Security SQL Injection. Vector Li CSE 127: Computer Security SQL Injection Vector Li November 14, 2017 A Magic Trick The functional specification only allowed seeing one user s posts at a time Current user s posts on view.php without

More information

You can use Dreamweaver to build master and detail Web pages, which

You can use Dreamweaver to build master and detail Web pages, which Chapter 1: Building Master and Detail Pages In This Chapter Developing master and detail pages at the same time Building your master and detail pages separately Putting together master and detail pages

More information

PHP MySQLi Class Documentation

PHP MySQLi Class Documentation PHP MySQLi Class Documentation Release 1.0 Read the Docs Sep 16, 2017 Contents 1 Installation 3 2 Initialization 5 2.1 Advanced initialization:......................................... 5 3 Insert Query

More information

4) PHP and MySQL. Emmanuel Benoist. Spring Term Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 1

4) PHP and MySQL. Emmanuel Benoist. Spring Term Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 1 4) PHP and MySQL Emmanuel Benoist Spring Term 2017 Berner Fachhochschule Haute cole spcialise bernoise Berne University of Applied Sciences 1 PHP and MySQL Introduction Basics of MySQL Create a Table See

More information

MySQL: Access Via PHP

MySQL: Access Via PHP MySQL: Access Via PHP CISC 282 November 15, 2017 phpmyadmin: Login http://cisc282.caslab. queensu.ca/phpmyadmin/ Use your NetID and CISC 282 password to log in 2 phpmyadmin: Select DB Clicking on this

More information

Database Connectivity using PHP Some Points to Remember:

Database Connectivity using PHP Some Points to Remember: Database Connectivity using PHP Some Points to Remember: 1. PHP has a boolean datatype which can have 2 values: true or false. However, in PHP, the number 0 (zero) is also considered as equivalent to False.

More information

Static Webpage Development

Static Webpage Development Dear Student, Based upon your enquiry we are pleased to send you the course curriculum for PHP Given below is the brief description for the course you are looking for: - Static Webpage Development Introduction

More information

MySQL: Querying and Using Form Data

MySQL: Querying and Using Form Data MySQL: Querying and Using Form Data CISC 282 November 15, 2017 Preparing Data $mysqli >real_escape_string($datavalue); Requires a $mysqli object Functional version mysqli_real_escape_string( ) does not

More information

APLIKACJE INTERNETOWE 8 PHP WYKORZYSTANIE BAZY DANYCH MYSQL

APLIKACJE INTERNETOWE 8 PHP WYKORZYSTANIE BAZY DANYCH MYSQL APLIKACJE INTERNETOWE 8 PHP WYKORZYSTANIE BAZY DANYCH MYSQL PLAN PREZENTACJI Bazy danych w PHP Połączenie z bazą danych Zamknięcie połączenie Tworzenie bazy danych Tworzenie tabeli Operacje na tabelach

More information

Lecture 7: Web hacking 3, SQL injection, Xpath injection, Server side template injection, File inclusion

Lecture 7: Web hacking 3, SQL injection, Xpath injection, Server side template injection, File inclusion IN5290 Ethical Hacking Lecture 7: Web hacking 3, SQL injection, Xpath injection, Server side template injection, File inclusion Universitetet i Oslo Laszlo Erdödi Lecture Overview What is SQL injection

More information

PHP for PL/SQL Developers. Lewis Cunningham JP Morgan Chase

PHP for PL/SQL Developers. Lewis Cunningham JP Morgan Chase PHP for PL/SQL Developers Lewis Cunningham JP Morgan Chase 1 What is PHP? PHP is a HTML pre-processor PHP allows you to generate HTML dynamically PHP is a scripting language usable on the web, the server

More information

Slide 1. Chapter 5. How to use the MVC pattern to organize your code. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C5

Slide 1. Chapter 5. How to use the MVC pattern to organize your code. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C5 Slide 1 Chapter 5 How to use the MVC pattern to organize your code and MySQL, C5 Slide 2 Objectives Applied 1. Use the MVC pattern to develop your web applications. 2. Create and use functions that do

More information

CSCI 4000 Assignment 4

CSCI 4000 Assignment 4 Austin Peay State University, Tennessee Spring 2018 CSCI 4000: Advanced Web Development Dr. Leong Lee CSCI 4000 Assignment 4 Total estimated time for this assignment: 12 hours (if you are a good programmer)

More information

Comp 519: Web Programming Autumn 2015

Comp 519: Web Programming Autumn 2015 Comp 519: Web Programming Autumn 2015 Advanced SQL and PHP Advanced queries Querying more than one table Searching tables to find information Aliasing tables PHP functions for using query results Using

More information

By the end of this chapter, you will have a very basic, but fully functional blogging system.

By the end of this chapter, you will have a very basic, but fully functional blogging system. C H A P T E R 5 Building the Entry Manager At this point, you know enough to start building your blog! In this chapter, I ll walk you through how to build the backbone of your blogging application. The

More information

School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University

School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University ITS331 Information Technology Laboratory I Laboratory #8: PHP & Form Processing II Objective:

More information

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

Web development using PHP & MySQL with HTML5, CSS, JavaScript Web development using PHP & MySQL with HTML5, CSS, JavaScript Static Webpage Development Introduction to web Browser Website Webpage Content of webpage Static vs dynamic webpage Technologies to create

More information

Smart Bulk SMS & Voice SMS Marketing Script with 2-Way Messaging. Quick-Start Manual

Smart Bulk SMS & Voice SMS Marketing Script with 2-Way Messaging. Quick-Start Manual Mobiketa Smart Bulk SMS & Voice SMS Marketing Script with 2-Way Messaging Quick-Start Manual Overview Mobiketa Is a full-featured Bulk SMS and Voice SMS marketing script that gives you control over your

More information

Troubleshooting. The NLR Web Interface Does not Appear CHAPTER

Troubleshooting. The NLR Web Interface Does not Appear CHAPTER CHAPTER 6 This chapter contains a number of basic troubleshooting scenarios, including some of the most common problems that need to be resolved to get the NLR operating correctly following a new installation,

More information

Host at 2freehosting.Com

Host at 2freehosting.Com Host at 2freehosting.Com This document will help you to upload your website to a free website hosting account at www.2freehosting.com/. Follow all the steps carefully in the order that they appear to ensure

More information

CSCI 4000 Assignment 5

CSCI 4000 Assignment 5 Austin Peay State University, Tennessee Spring 2016 CSCI 4000: Advanced Web Development Dr. Leong Lee CSCI 4000 Assignment 5 Total estimated time for this assignment: 12 hours (if you are a good programmer)

More information

CERTIFICATE IN WEB PROGRAMMING

CERTIFICATE IN WEB PROGRAMMING COURSE DURATION: 6 MONTHS CONTENTS : CERTIFICATE IN WEB PROGRAMMING 1. PROGRAMMING IN C and C++ Language 2. HTML/CSS and JavaScript 3. PHP and MySQL 4. Project on Development of Web Application 1. PROGRAMMING

More information

Server-side web security (part 2 - attacks and defences)

Server-side web security (part 2 - attacks and defences) Server-side web security (part 2 - attacks and defences) Security 1 2018-19 Università Ca Foscari Venezia www.dais.unive.it/~focardi secgroup.dais.unive.it Basic injections $query = "SELECT name, lastname,

More information

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1 Shell Scripting Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 If we have a set of commands that we want to run on a regular basis, we could write a script A script acts as a Linux command,

More information

Daniel Pittman October 17, 2011

Daniel Pittman October 17, 2011 Daniel Pittman October 17, 2011 SELECT target-list FROM relation-list WHERE qualification target-list A list of attributes of relations in relation-list relation-list A list of relation names qualification

More information

Build a Subfile with PHP

Build a Subfile with PHP Build a Subfile with PHP Workshop: Build a Subfile with PHP Module 2: Formatting Customer Records in an HTML Table, and Adding a Search Form Contents Formatting Customer Records in an HTML Table, and Adding

More information

Create Basic Databases and Integrate with a Website Lesson 3

Create Basic Databases and Integrate with a Website Lesson 3 Create Basic Databases and Integrate with a Website Lesson 3 Combining PHP and MySQL This lesson presumes you have covered the basics of PHP as well as working with MySQL. Now you re ready to make the

More information

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population In this lab, your objective is to learn the basics of creating and managing a DB system. One way to interact with the DBMS (MySQL)

More information

Prepared Statement. Always be prepared

Prepared Statement. Always be prepared Prepared Statement Always be prepared The problem with ordinary Statement The ordinary Statement was open to SQL injections if fed malicious data. What would the proper response to that be? Filter all

More information

Web accessible Databases PHP

Web accessible Databases PHP Web accessible Databases PHP October 16, 2017 www.php.net Pacific University 1 HTML Primer https://www.w3schools.com/html/default.asp HOME Introduction Basic Tables Lists https://developer.mozilla.org/en-

More information

Unit 27 Web Server Scripting Extended Diploma in ICT

Unit 27 Web Server Scripting Extended Diploma in ICT Unit 27 Web Server Scripting Extended Diploma in ICT Dynamic Web pages Having created a few web pages with dynamic content (Browser information) we now need to create dynamic pages with information from

More information

CONTENTS IN DETAIL INTRODUCTION 1 THE FAQS OF LIFE THE SCRIPTS EVERY PHP PROGRAMMER WANTS (OR NEEDS) TO KNOW 1 2 CONFIGURING PHP 19

CONTENTS IN DETAIL INTRODUCTION 1 THE FAQS OF LIFE THE SCRIPTS EVERY PHP PROGRAMMER WANTS (OR NEEDS) TO KNOW 1 2 CONFIGURING PHP 19 CONTENTS IN DETAIL INTRODUCTION xiii 1 THE FAQS OF LIFE THE SCRIPTS EVERY PHP PROGRAMMER WANTS (OR NEEDS) TO KNOW 1 #1: Including Another File as a Part of Your Script... 2 What Can Go Wrong?... 3 #2:

More information

Side-channel attacks (and blind SQL injections)

Side-channel attacks (and blind SQL injections) Side-channel attacks (and blind SQL injections) Security 1 2018-19 Università Ca Foscari Venezia www.dais.unive.it/~focardi secgroup.dais.unive.it Introduction It is often the case that applications have

More information

CSCI 4000 Assignment 6

CSCI 4000 Assignment 6 Austin Peay State University, Tennessee Spring 2018 CSCI 4000: Advanced Web Development Dr. Leong Lee CSCI 4000 Assignment 6 Total estimated time for this assignment: 6 hours (if you are a good programmer)

More information

Locate your Advanced Tools and Applications

Locate your Advanced Tools and Applications MySQL Manager is a web based MySQL client that allows you to create and manipulate a maximum of two MySQL databases. MySQL Manager is designed for advanced users.. 1 Contents Locate your Advanced Tools

More information

Mobile Forms Integrator

Mobile Forms Integrator Mobile Forms Integrator Introduction Mobile Forms Integrator allows you to connect the ProntoForms service (www.prontoforms.com) with your accounting or management software. If your system can import a

More information

Programming for the Web with PHP

Programming for the Web with PHP Aptech Ltd Version 1.0 Page 1 of 11 Table of Contents Aptech Ltd Version 1.0 Page 2 of 11 Abstraction Anonymous Class Apache Arithmetic Operators Array Array Identifier arsort Function Assignment Operators

More information

Courtesy of Clayton Fyfe. Lab 2 Runthrough

Courtesy of Clayton Fyfe. Lab 2 Runthrough Courtesy of Clayton Fyfe Lab 2 Runthrough Highlights 1. Accessing and Using phpmyadmin 2. CRUD for phpmyadmin 3. Microsoft expression WEB 3 Overview 4. CRUD for PHP 5. Adding Files to the playground Accessing

More information

Mount Saint Mary College, Newburgh, NY Internet Programming III - CIT310

Mount Saint Mary College, Newburgh, NY Internet Programming III - CIT310 Warm up mini-lab Lab 1 - Functions Type in the following function definition and calls to the function. Test it and understand it. function myprint($str= No String Supplied ) // the argument is optional

More information

Vesta Control Panel is a stack of software components which is roughly divided into two main layers as shown below in the architecture diagram.

Vesta Control Panel is a stack of software components which is roughly divided into two main layers as shown below in the architecture diagram. VESTA CONTROL PANEL While Vesta is arguably one of the most popular open source control panel, its history is actually quite short considering the timeline of control panels. It all started back in 2010

More information

Adding A PHP+MySQL Hit Counter to your Website

Adding A PHP+MySQL Hit Counter to your Website Adding A PHP+MySQL Hit Counter to your Website Setting up MySQL First off, decide what you want to keep track of. In this case, let s commit to tracking total number of hits on each of a number of web

More information

B. V. Patel Institute of BMC & IT 2014

B. V. Patel Institute of BMC & IT 2014 Unit 1: Introduction Short Questions: 1. What are the rules for writing PHP code block? 2. Explain comments in your program. What is the purpose of comments in your program. 3. How to declare and use constants

More information

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

Introduction to PHP. Handling Html Form With Php. Decisions and loop. Function. String. Array Introduction to PHP Evaluation of Php Basic Syntax Defining variable and constant Php Data type Operator and Expression Handling Html Form With Php Capturing Form Data Dealing with Multi-value filed Generating

More information

This lecture. PHP tags

This lecture. PHP tags This lecture Databases I This covers the (absolute) basics of and how to connect to a database using MDB2. (GF Royle 2006-8, N Spadaccini 2008) I 1 / 24 (GF Royle 2006-8, N Spadaccini 2008) I 2 / 24 What

More information

Module - P7 Lecture - 15 Practical: Interacting with a DBMS

Module - P7 Lecture - 15 Practical: Interacting with a DBMS Introduction to Modern Application Development Prof. Tanmai Gopal Department of Computer Science and Engineering Indian Institute of Technology, Madras Module - P7 Lecture - 15 Practical: Interacting with

More information

LAMP Apps. Overview. Learning Outcomes: At the completion of the lab you should be able to:

LAMP Apps. Overview. Learning Outcomes: At the completion of the lab you should be able to: LAMP Apps Overview This lab walks you through using Linux, Apache, MySQL and PHP (LAMP) to create simple, yet very powerful PHP applications connected to a MySQL database. For developers using Windows,

More information

Jacksonville Linux User Group Presenter: Travis Phillips Date: 02/20/2013

Jacksonville Linux User Group Presenter: Travis Phillips Date: 02/20/2013 Jacksonville Linux User Group Presenter: Travis Phillips Date: 02/20/2013 Welcome Back! A Quick Recap of the Last Presentation: Overview of web technologies. What it is. How it works. Why it s attractive

More information

ITS331 IT Laboratory I: (Laboratory #11) Session Handling

ITS331 IT Laboratory I: (Laboratory #11) Session Handling School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University ITS331 Information Technology Laboratory I Laboratory #11: Session Handling Creating

More information

Databases PHP I. (GF Royle, N Spadaccini ) PHP I 1 / 24

Databases PHP I. (GF Royle, N Spadaccini ) PHP I 1 / 24 Databases PHP I (GF Royle, N Spadaccini 2006-2010) PHP I 1 / 24 This lecture This covers the (absolute) basics of PHP and how to connect to a database using MDB2. (GF Royle, N Spadaccini 2006-2010) PHP

More information

Introduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018

Introduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018 Introduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018 Background Information 2 Background Information What is a (Relational) Database 3 Dynamic collection of information. Organized into tables,

More information

PHP and MySQL Programming

PHP and MySQL Programming PHP and MySQL Programming Course PHP - 5 Days - Instructor-led - Hands on Introduction PHP and MySQL are two of today s most popular, open-source tools for server-side web programming. In this five day,

More information

Simple sets of data can be expressed in a simple table, much like a

Simple sets of data can be expressed in a simple table, much like a Chapter 1: Building Master and Detail Pages In This Chapter Developing master and detail pages at the same time Building your master and detail pages separately Putting together master and detail pages

More information

Overview of MySQL Structure and Syntax [2]

Overview of MySQL Structure and Syntax [2] PHP PHP MySQL Database Overview of MySQL Structure and Syntax [2] MySQL is a relational database system, which basically means that it can store bits of information in separate areas and link those areas

More information

Product: DQ Order Manager Release Notes

Product: DQ Order Manager Release Notes Product: DQ Order Manager Release Notes Subject: DQ Order Manager v7.1.29 Version: 1.0 January 20, 2017 Distribution: ODT Customers DQ OrderManager v7.1.29 *** requires db update 20170120 or newer ***

More information

Web insecurity Security strategies General security Listing of server-side risks Language specific security. Web Security.

Web insecurity Security strategies General security Listing of server-side risks Language specific security. Web Security. Web Security Web Programming Uta Priss ZELL, Ostfalia University 2013 Web Programming Web Security Slide 1/25 Outline Web insecurity Security strategies General security Listing of server-side risks Language

More information

PHP APIs. Rapid Learning & Just In Time Support

PHP APIs. Rapid Learning & Just In Time Support PHP APIs Rapid Learning & Just In Time Support CONTENT 1 INTRODUCTION... 3 1.1 Create PHP Application... 4 1.1.1 Create PHP Console Application... 4 1.1.2 Create PHP Web Application... 4 2 DATA BASE...

More information

Chapter 1 An introduction to relational databases and SQL

Chapter 1 An introduction to relational databases and SQL Chapter 1 An introduction to relational databases and SQL Murach's MySQL, C1 2015, Mike Murach & Associates, Inc. Slide 1 Objectives Knowledge Identify the three main hardware components of a client/server

More information

MYSQL DATABASE ACCESS WITH PHP

MYSQL DATABASE ACCESS WITH PHP MYSQL DATABASE ACCESS WITH PHP Fall 2010 CSCI 2910 Server-Side Web Programming Typical web application interaction Database Server 3 tiered architecture Security in this interaction is critical Web Server

More information

Ark Database Documentation

Ark Database Documentation Ark Database Documentation Release 0.1.0 Liu Dong Nov 24, 2017 Contents 1 Introduction 3 1.1 What s included............................................. 3 1.2 Supported Drivers............................................

More information

Andowson Chang

Andowson Chang Andowson Chang http://www.andowson.com/ All JForum templates are stored in the directory templates, where each subdirectory is a template name, being the default template name callled default. There you

More information

PHP INTERVIEW QUESTION-ANSWERS

PHP INTERVIEW QUESTION-ANSWERS 1. What is PHP? PHP (recursive acronym for PHP: Hypertext Preprocessor) is the most widely used open source scripting language, majorly used for web-development and application development and can be embedded

More information

Adrien Poupa TP040869

Adrien Poupa TP040869 Adrien Poupa TP040869 Table of Contents Gantt chart Page 3 Introduction and objectives Page 4 System design Storyboards Page 5 Flowcharts Page 8 Implementation Design Page 10 PHP Page 11 MySQL Database

More information

PHP: Hypertext Preprocessor. A tutorial Introduction

PHP: Hypertext Preprocessor. A tutorial Introduction PHP: Hypertext Preprocessor A tutorial Introduction Introduction PHP is a server side scripting language Primarily used for generating dynamic web pages and providing rich web services PHP5 is also evolving

More information

How to create secure web sites

How to create secure web sites 2017, Mike Murach & Associates, Inc. 1/20/2019 A request made with a secure connection Chapter 21 How to create secure web sites The URL starts with https A lock icon is displayed C21, Slide 1 2017, Mike

More information

SQL. Often times, in order for us to build the most functional website we can, we depend on a database to store information.

SQL. Often times, in order for us to build the most functional website we can, we depend on a database to store information. Often times, in order for us to build the most functional website we can, we depend on a database to store information. If you ve ever used Microsoft Excel or Google Spreadsheets (among others), odds are

More information

Textbook. Topic 8: Files and Exceptions. Files. Types of Files

Textbook. Topic 8: Files and Exceptions. Files. Types of Files Textbook Topic 8: Files and A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams 1 Strongly Recommended

More information

Chapter 10: MySQL & PHP. PHP and MySQL CIS 86 Mission College

Chapter 10: MySQL & PHP. PHP and MySQL CIS 86 Mission College Chapter 10: MySQL & PHP PHP and MySQL CIS 86 Mission College Tonight s agenda Drop the class? Login file Connecting to a MySQL database Object-oriented PHP Executing a query Fetching a result Fetching

More information

COM1004 Web and Internet Technology

COM1004 Web and Internet Technology COM1004 Web and Internet Technology When a user submits a web form, how do we save the information to a database? How do we retrieve that data later? ID NAME EMAIL MESSAGE TIMESTAMP 1 Mike mike@dcs Hi

More information

Using PHPMyAdmin with WordPress

Using PHPMyAdmin with WordPress Using PHPMyAdmin with WordPress A basic run-down of some of the things you may want to do manually on your WordPress database. (Using PHPMyAdmin) Kenneth Hargis Managing Partner ken@orphicworkshop.com

More information

A shell can be used in one of two ways:

A shell can be used in one of two ways: Shell Scripting 1 A shell can be used in one of two ways: A command interpreter, used interactively A programming language, to write shell scripts (your own custom commands) 2 If we have a set of commands

More information

CSE 154 LECTURE 23:RELATIONAL DATABASES AND SQL

CSE 154 LECTURE 23:RELATIONAL DATABASES AND SQL CSE 154 LECTURE 23:RELATIONAL DATABASES AND SQL Relational databases relational database: A method of structuring data as tables associated to each other by shared attributes. a table row corresponds to

More information

Using.htaccess to Restrict OU Directory by Usernames and Passwords in an.htpasswd File

Using.htaccess to Restrict OU Directory by Usernames and Passwords in an.htpasswd File Using.htaccess to Restrict OU Directory by Usernames and Passwords in an.htpasswd File (Last updated on 9/3/2015 by lucero@uark.edu) This method requires the management of three files,.htaccess,.htpasswd,

More information

Part I Quick Start Installation 2. Part II Manual Installation 8. Part III Ixed directory 10

Part I Quick Start Installation 2. Part II Manual Installation 8. Part III Ixed directory 10 Part I Quick Start Installation 2 1 Preliminary actions... 2 2 Running the install... script 2 3 Multilingual Support... 4 One Language Support... 4 Multiple Languages... Support 5 Flag Icons... 6 Important

More information

Advanced Web Technology 10) XSS, CSRF and SQL Injection

Advanced Web Technology 10) XSS, CSRF and SQL Injection Berner Fachhochschule, Technik und Informatik Advanced Web Technology 10) XSS, CSRF and SQL Injection Dr. E. Benoist Fall Semester 2010/2011 1 Table of Contents Cross Site Request Forgery - CSRF Presentation

More information

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008.

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008. PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008. Outline. How cookies work. Cookies in PHP. Sessions. Databases. Cookies. Sometimes it is useful to remember a client when it comes

More information

Injection. CSC 482/582: Computer Security Slide #1

Injection. CSC 482/582: Computer Security Slide #1 Injection Slide #1 Topics 1. Injection Attacks 2. SQL Injection 3. Mitigating SQL Injection 4. XML Injection Slide #2 Injection Injection attacks trick an application into including unintended commands

More information

COMP519: Web Programming Autumn 2015

COMP519: Web Programming Autumn 2015 COMP519: Web Programming Autumn 2015 In the next lectures you will learn What is SQL How to access mysql database How to create a basic mysql database How to use some basic queries How to use PHP and mysql

More information

PHP Reference. To access MySQL manually, run the following command on the machine, called Sources, where MySQL and PhP have been installed:

PHP Reference. To access MySQL manually, run the following command on the machine, called Sources, where MySQL and PhP have been installed: PHP Reference 1 Preface This tutorial is designed to teach you all the PHP commands and constructs you need to complete your PHP project assignment. It is assumed that you have never programmed in PHP

More information