Creating a Dynamic Web Site Stewart Blakeway FML 208

Slides:



Advertisements
Similar presentations
CINAHL DATABASE FOR HINARI USERS: nursing and allied health information (Module 7.1)
Advertisements

UOW Purchasing Card Application Coding & Approval Presentation.
How to Enter Time/Leave Select: Log In Enter your CCU User Name and Password * Once logged in, Select: Employees * Note: (if you do not know it, click.
Organisation Of Data (1) Database Theory
09/04/2015Unit 2 (b) Back-Office processes Unit 2 Assessment Criteria (b) 10 marks.
1 CS2SPE- Group project presentation Haia Al-Majali Bojin Zhou Rania Ali Suraj Patel Fatima Tunc Victoria Casas Sam Diab 19 th March 2008.
COM621 Interactive Web Development Dr. Jose Santos MS 017A.
Indistar: Updates, Additions, and Coming Soon Stephanie Benedict, ADI.
NMED 3850 A Advanced Online Design February 25, 2010 V. Mahadevan.
Faculty of Sciences and Social Sciences HOPE Different Users and Uploading Files Stewart Blakeway FML 213
Faculty of Sciences and Social Sciences HOPE User Sessions & The Include Statement Stewart Blakeway FML 213
Faculty of Sciences and Social Sciences HOPE PHP & MySQL Stewart Blakeway FML 213
Faculty of Sciences and Social Sciences HOPE PHP – Working with Input Stewart Blakeway FML 213
Faculty of Sciences and Social Sciences HOPE Uploading Resources Stewart Blakeway FML 213
PHP (2) – Functions, Arrays, Databases, and sessions.
J4www/jea Week 3 Version Slide edits: nas1 Format of lecture: Assignment context: CRUD - “update details” JSP models.
Reference and Instruction Automated Statistics Gathering and Reporting System Members: Patrick Chen (pyc7) Soo-Yung Cho (sc444) Gregg Herlacher (gah24)
New Student Orientation Registration System Stephen Nakamura EE496 Final Presentation Fall 2008.
Quick Start Guide. This 22 page introduction to the Financial Assessment Subsystem provides the user with a visual overview of the components of the system.
Software Development, Programming, Testing & Implementation.
STOCKDOC Advanced Stock Management System
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
U:/msu/course/cse/103 Day 25, Slide 1 Back-up PHP Files If you have not yet passed the 3.0 BT, make back-up copies of ALL.
1 Insert, Update and Delete Queries. 2 Return to you Address Book database. Insert a record.
Administration Tab CiviCRM. Data Organization in CiviCRM: "Building Blocks" Contacts Reports Mail Tags Activities Contribe Member Events and Event Attendences.
Getting started on informaworld™ How do I register my institution with informaworld™? How is my institution’s online access activated? What do I do if.
MDECA SECURITY UPDATES Update & Review for Security Changes!
What is Sure BDCs? BDC stands for Batch Data Communication and is also known as Batch Input. It is a technique for mass input of data into SAP by simulating.
® IBM Software Group © 2009 IBM Corporation Rational Publishing Engine RQM Multi Level Report Tutorial David Rennie, IBM Rational Services A/NZ
System for Administration, Training, and Educational Resources for NASA SATERN Overview for Learners May 2006.
MySQL + PHP.  Introduction Before you actually start building your database scripts, you must have a database to place information into and read it from.
1 MySQL and phpMyAdmin. 2 Navigate to and log on (username: pmadmin)
The Online Volunteer Log (Talbot County) *Live as of February 19 th, AM.
Mark Dixon Page 1 23 – Web applications: Writing data to Databases using PhP.
Creating a Web Site to Gather Data and Conduct Research.
Welcome to the Manage Inventory lesson for the North Carolina Immunization Branch. Contents: Adding Inventory Modifying Inventory Inventory Reports **
CINAHL DATABASE FOR HINARI USERS: nursing and allied health information (Module 7.1)
PHP meets MySQL.
CSS/417 Introduction to Database Management Systems Workshop 2.
G053 - Lecture 16 Validating Forms Mr C Johnston ICT Teacher
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
Week seven CIT 354 Internet II. 2 Objectives Database_Driven User Authentication Using Cookies Session Basics Summary Homework and Project 2.
Discovering Computers Fundamentals Fifth Edition Chapter 9 Database Management.
NMD202 Web Scripting Week3. What we will cover today Includes Exercises PHP Forms Exercises Server side validation Exercises.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Views Lesson 7.
Childcare And Family Information Service Anne Lalley Choice Adviser.
MEMBERSHIP AND IDENTITY Active server pages (ASP.NET) 1 Chapter-4.
1 ACTIVATION OF THE ST ScI ELECTRONIC GRANTS MANAGEMENT SYSTEM BY INSTITUTIONAL AUTHORIZING OFFICIALS January, 2001.
Advanced Web 2012 Lecture 6 Sean Costain Files Sean Costain 2012 Php allows for the : Creation Reading Appending Deleting Uploading And Closing.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
 Empowers to your customer  Product Rating and its Management in Ecommerce Framework  Product Reviews and Management: Collecting customer opinion about.
 Shopping Basket  Stages to maintain shopping basket in framework  Viewing Shopping Basket.
COMP3241 E-Commerce Technologies Richard Henson University of Worcester November 2014.
Database Access Control IST2101. Why Implementing User Authentication? Remove a lot of redundancies in duplicate inputs of database information – Your.
CPSC 203 Introduction to Computers T97 By Jie (Jeff) Gao.
MySQL MySQL and PHP – interacting with a database.
PHP Form Processing * referenced from
Navigation: If the tutorial opens up in your web browser, simply click your mouse to advance to the next slide. Use the “Backspace”
Learning Aim C.  In this section we will look at how text, tables, forms and frames can be used in web pages.
Form Data (part 2) MIS 3502, Fall 2015 Brad N Greenwood, PhD Department of MIS Fox School of Business Temple University 11/10/2015 Slide 1.
COM621 – Interactive Web Development 2015/2016 Module Co-Ordinator: Dr. Pratheepan Yogarajah Room:
Welcome to BLT Online NQT Induction.
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
The first step in creating a new Proposal is to navigate to and login using your University credentials, meaning the same username.
5.8 Presentation.
Presentation transcript:

Creating a Dynamic Web Site Stewart Blakeway FML 208

What will we cover  Deleting Records  Amending Records

Why  You need to authenticate the user before allowing them to delete/amend records  You need to be able to delete/amend records as a user and as an administrator  With conditions

User Sessions  You will have to authenticate the log in of the user in order to allow the addition of records into the database  You have to follow certain steps in order to ensure that the user is who they claim to be  Refer to slides from last week if you have forgotten how to do this

Deleting Data  Before we allow the deletion of data we need to ensure the user is logged in  We have to establish if the user is authorised to delete the record  The user added that particular book  The user has administrator privileges

Deleting Structure if user not logged in { display login link } else { display form to select record display the selected record and confirm deletion delete the selected record }

Further refinement if form not yet displayed { display form to select record to delete } else if record selected { display the selected record } else if delete confirmed { delete the record }

Checking to see if the user has logged in <?php if (!isset($_SESSION[‘username']) { echo "not authorised"; echo " Login "; } else { // DISPLAY THE FORM }

Displaying the form  This form is different to the forms we have already seen. So far we have seen a form that passes data to itself and does a simple if else check if (!isset($_POST[‘viewed’])) { // Display form } else { // Process Data }

3 Checks  This time we have 3 major checks with the processing of the form 1. Has form been displayed? 2. Has user selected the record? 3. Has user confirmed deletion of the record?

Display Records and Get Users Selection Show user their selection and Confirm Delete Delete / Not Delete the Record

3 Checks if (!isset($_POST[‘selected’])) { // Display form and get selection } if (isset ($_POST[‘selected’])) { // Display selection for confirmation } if (isset ($_POST[‘delete’])) { // Delete the record }

Another Check  Just because the user is logged in does not mean that they are authorised to delete the record!  Should user Smith be able to delete an entry added by Williams?  What about the administrator of the website or the content manager?

Simple Check if user != user that initially added the record { display “not authorised”; } else { delete the record }

Refined if user != user that initially added the record or user != “administrator” { display “not authorised”; } else { delete the record }

What about future growth?  Initially your website is small and only has two or three administrators.  As your website grows your administration team will grow.  What if your administration team becomes four strong?

Not a great solution! if user != user that initially added the record or user != “administrator” or user != “content_administrator” or user != “designer_administrator” or user != “stradministrator” { display “not authorised”; } else { delete the record }

What about now? if user != user that initially added the record or user_level != “administrator” { display “not authorised”; } else { delete the record }

so far! if user authorised if form not displayed if record selected if delete confirmed if user = original user if user level = administrator and couple of whiles (for the extraction of data) That ’ s a lot of {{{{}}}}} and we haven ’ t even included any validation of the text entry boxes!

Indentation & Comments  Your code is growing with each conditional IF you insert.  You have to indent your code so that it reads well.  You have to comment your code throughout.  Failure to comment code and indent throughout will result in marks being deducted Better Still – Break your code down into functions, try not to over use functions though

Display Records and Get Users Selection Show user their selection and Confirm Delete Delete / Not Delete the Record function showRecords() function showSelected() function deleteRecord()

So how do we delete? DELETE FROM table WHERE something = ‘ something' DELETE FROM `user` WHERE name = 'Carl'

Amending Records Structure if form not yet displayed { display form to select record to amend } else if record selected { display the selected record allow amendments } else if amend confirmed { amend the record }

Displaying the form  This form is very similar to deleting a record in that there are three if conditions if (($_POST[viewed] != "yes") && ($_POST[viewed] != "amend")) { // Display form and Set viewed = “ yes ” } elseif ($_POST[viewed] != "amend") { // Process Data and Set viewed = “ amend ” } else { // Amend the Record }

Amending the Record $sql = “ UPDATE book SET ( ‘ username ’ = '$_POST[bUsername]', ‘ bookTitle ’ = '$_POST[bTitle]', ‘ bookType ’ = '$_POST[bType]', ‘ bookDesc ’ = '$_POST[bDesc]', ‘ bookPrice ’ = '$_POST[bPrice] ‘ WHERE ‘ bookID ’ = ‘ $_POST[bID] ’ )";

A Week Friday  Submission of Portfolio Exercises  Save onto CD  Submitted to Deanery Office by 3pm  Worth 40% of PBL 3

After Easter  Test  Submission of Website  Working Website  Connectivity to the database  Able to add/view/delete/update records  User able to register  User Login and Authentication  Appropriate validation on text fields  Appropriate use of CSS  Cross browser/platform support  Code must be commented throughout  Database  Team Report  Reflection

Test  2 Sections  10 Multiple Choice Questions worth 10 marks  Code to debug, 15 Errors worth 30 marks

Example Question Question – Which best describes an Associate Array? a)Associate Arrays use a numbered index; you can specify the index with any integer value. An associative array is principally the same as an ordinary array – however instead of labelled indexes you use integers. b)Associate Arrays do not use a numbered index; you can specify the index with meaningful names. An associative array is principally the same as an ordinary index array – however instead of numbered indexes you use labels. c)Associate Arrays do not use an index at all; when you build the array the items are sorted automatically which eliminates the need for such an index. d)Associate Arrays are a combination of two or more arrays with a relationship to the parent array of the parent class. The child class or child array within the child class will inherit all the values from the parent array contained within the parent class.

Example Code $conn = mysql_connect("localhost","stewart",""); mysql_select_database("sbass",$conn); if (($_POST[viewed] != "yes") & ($_POST[viewed] != "amend")) { echo " Select Entry "; $get_list = "SELECT bookTitle FROM book"; $get_list_res = mysql_query(get_list); echo " Select a Record to View <select name=\"sel_book\" -- Select a Book -- "; … 5 Errors – Can you spot them?

Example Code $conn = mysql_connect("localhost","stewart",""); mysql_select_db("sbass",$conn); if (($_POST[viewed] != "yes") && ($_POST[viewed] != "amend")) { echo " Select Entry "; $get_list = "SELECT bookTitle FROM book"; $get_list_res = mysql_query($get_list); echo = " Select a Record to View -- Select a Book -- "; …

Any Questions?

Conclusion