**
* Allows one to view all tables and their data in a database
*
equire_once("conn.php");
$sql = "SHOW TABLES";
$tables = $dbConn->query($sql);
$tablesAndTheirData = a
ay();
while($tableName = $tables->fetch_a
ay()) {
$sql = "SELECT * FROM $tableName[0] limit 200";
$data = $dbConn->query($sql);
a
ay_push($tablesAndTheirData, a
ay(
'name' => $tableName[0],
'fields' => $data->fetch_fields(),
'data' => $data
));
}
?
!DOCTYPE html
html lang="en"
head
Database Tables
title
head
ody
!-- The ':' in php gives an alternative way for introducing control structures.
For details, please see http:
php.net/manual/en/control-structures.alternative-syntax.php
--
?php foreach($tablesAndTheirData as $table): ?
h2
code
?php echo $table['name'];?
code> Table
h2
num_rows):?
| ?php echo $field->name;?
td
t
thead
fetch_assoc()): ?
$value):?
| ?php echo $value; ?
td
t
tbody
table
Table does not have any data
p
?php endforeach;
$dbConn->close();
?
ody
html
dataDictionary
1
SCHOOL OF COMPUTER, DATA & MATHEMATICAL SCIENCES
XXXXXXXXXX: TECHNOLOGIES FOR WEB APPLICATIONS
Autumn 2020: Web Application Assignment
247Music Data Dictionary
The 247Music database consists of 6 tables. Each table is described below. A description of how to connect to the database is
given at the end of this document.
Table Name: track
This table provides details about songs (tracks), the recording artist (artist) and the album on which the song was released.
Your database credentials will only have Select privileges for this table.
Column Type Null Default Comments
track_id int No
This is an auto incrementing number to uniquely identify a table
ow. It is the unique song identification number.
track_title varchar(200) No
Song title
artist_id int No
Recording artist id
track_length varchar(6) Yes NULL Playing length of the song in minutes and seconds (eg, 2:52)
spotify_track varchar(40) Yes NULL Track identifier on Spotify (for play a short preview clip)
album_id int No unique album identification numbe
Table Name: artist
This table provides details about the recording artist (artist).
Your database credentials will only have Select privileges for this table.
Column Type Null Default Comments
artist_id int No
This is an auto incrementing number to uniquely identify a table
ow. It is the unique artist identification number
artist_name varchar(200) No
Recording artist name
thumbnail varchar(200) Yes Null Filename of thumbnail image for the artist
Table Name: album
This table provides details about music albums.
Your database credentials will only have Select privileges for this table.
Column Type Null Default Comments
album_id int No
This is an auto incrementing number to uniquely identify a table
ow. It is the unique album identification number
album_name varchar(200) No
Album name
album_date year Yes Null Year of release of album
thumbnail varchar(200) Yes Null Filename of thumbnail image for the album
artist_id int No unique artist identification number
2
Table Name: membership
This table provides details about members (subscribers) of 24/7Music. It provides their personal information, and login credentials
(username and password). Your TWA student database credentials will only have Select privileges for this table.
Note: passwords are encrypted using the sha256 algorithm. For testing purposes, the plain text passwords are given in the
Member Login Credentials document.
Column Type Null Default Comments
member_id int No This is an auto incrementing number to uniquely identify a table
ow. It is the unique member id
username varchar(100) No
member username. This is used by the member to login to the
web application
surname varchar(50) No
member surname
firstname varchar(50) No member first name
password varchar(300) No
member password. This is used for authentication in
combination with the username. The value stored in this field is
encrypted using the sha256 algorithm. See above note.
category varchar(10) No The type of membership held by the member. Possible values
are Free, Premium, Family
Table Name: memberPlaylist
This table provides details about Playlists that have been created by members. A member may have zero or many playlists.
Your TWA student database credentials will have Select and Insert privileges for this table.
Column Type Null Default Comments
playlist_id int No This is an auto incrementing number to uniquely identify a table
ow. You do not insert this number into the database it is
determined automatically. It is the unique playlist identification.
member_id int No
member username.
playlist_name varchar(30) No Name of the playlist supplied by the membe
Table Name: playlist
This table identifies the tracks for each playlist. A playlist may have zero or many tracks.
Your TWA student database credentials will have Select and Insert privileges for this table.
Column Type Null Default Comments
id int No
This is an auto incrementing number to uniquely identify a
table row. You do not insert this number into the database it is
determined automatically.
playlist_id int No
unique playlist identification number.
track_id int No unique song identification number.
Connecting to the 247Music Database
To connect to the 247Music database use the following in your php script
$dbConn = new mysqli("localhost", "TWA_student", "TWA_2020_Autumn", "247Music");
if($dbConn->connect_e
or) {
die("Failed to connect to database " . $dbConn->connect_e
or);
}
Note
The tables within the 247Music database have already been populated with some data. Use the supplied allTables.php
script to view the data (make sure you use the connection information as indicated above).
TWAassignment_Autumn2020
SCHOOL OF COMPUTER, DATA & MATHEMATICAL SCIENCES
300582: TECHNOLOGIES FOR WEB APPLICATIONS
Autumn 2020: Web Application Assignment
Due by 11:59pm on Friday 5th June XXXXXXXXXXAssessment Weight: 50%
A. Requirements
a) ALL instructions given in this document MUST be followed in order to be eligible for full marks for the Web Application
Assignment. This document has four (4) pages.
) This assignment is NOT a group assignment; collusion, plagiarism, cheating of any kind is not acceptable. As part of your
submission you MUST certify that all work submitted is your own. If you cannot honestly certify that the work is your own
then do not submit the assignment. Breaches of the Misconduct Rule will be dealt with according to the university policy
(see the learning guide for more information).
c) All assignment submissions will be checked for academic misconduct by the use of the MOSS program from Stanford
University. Details on MOSS can be obtained from the MOSS web site http:
theory.stanford.edu/~aiken/moss/
d) Design the web pages with ease of navigation and operation, attractiveness and accessibility in mind. Images other than
those provided in the assignment zip file (if any) may also be used in the assignment.
e) All assignment source files are to be uploaded to the Assignment1 folder of your TWA web site prior to the due date and
time. You may create subfolders within this folder if you wish.
- Compressed archive files (eg, zip, tar etc) are not acceptable and will not count toward submission requirements.
f) The submission script must then be used to submit your work once all work is on your TWA website. Failure to use this
script will result in a non-submission. See section D of this document for submission details.
g) All styling and page layout must be achieved using CSS. The use of Bootstrap or other frameworks is not permitted.
For the problem definition described in section B you must
h) include your authorship details at the top of each file in coded comments;
i) reference all sources that you used for inspiration of your solution as per Section C of this document;
j) ensure that your web application renders co
ectly in Chrome and runs co
ectly from the TWA web server.
B. Web Application Assignment Details
B(i) - Background information and description
Depending on which provider you use and the type of music that you want to stream there are cu
ently multiple music streaming
services available such as Spotify, Deezer, Tidal, Amazon Prime Music, Apple Music, PrimePhonic, and YouTube Music.
In this assignment you will create a web-based application for a product similar to Spotify named 24/7Music.
The 24/7Music web application will allow
• members and non-members to search for songs, artists, albums
• members and non-members to view lists of songs, artists, albums
• members and non-members to play short samples of selected songs
• members to create playlists of their favourite songs
This is a very simplified web application and leaves out aspects that would be required in a real music streaming web application
[such as actually streaming the music!!]. Read the Functional Requirements section (section B(ii) of this document) to determine
what is specifically required for 24/7Music. The MySQL database that supports the functionality of 24/7Music is named 247Music.
The 247Music database is described in section B(iii) of this document. You will need to design and create the PHP web pages for
this assignment.
B(ii) – Functional Requirements
The 24/7Music web application must
a) be coded using HTML 5, CSS, JavaScript, and PHP as necessary. Note: all files described below must be PHP files to
achieve the server-side functionality.
) provide easy-to-use navigation for the user as described in the following page descriptions.
c) provide the following page content and functionality for each page as described.
Search Page (search.php)
Page purpose/description:
This page is a search page to find songs, artists, or albums. The search page can be used by both non-members and
members.
Page 2 of 4
Page content:
The page will have the following content:
1. Navigation to the other pages of 24/7Music as appropriate including a Log Out link (if the user is logged in) or a
Log In link (if the user is not logged in).
2. member username (if the user is logged in)
3. membership category (if the user is logged in)