0% found this document useful (0 votes)
66 views49 pages

Musical World

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views49 pages

Musical World

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 49

Musical World

1. Introduction

1.1. Project Context

The Musical World project aims to develop a web-based platform where users can
stream music, create playlists, and manage their favourite tracks. This project is
inspired by the increasing popularity of digital music consumption, which has
transformed how people listen to music, moving away from physical media to online
streaming.

1.2. Purpose and Description

The purpose of this project is to create a comprehensive Musical World application


that allows users to listen to music online, manage playlists, and explore new tracks
and artists. The application will support user registration, login, music uploads, and
playlist creation, providing a user-friendly interface for both casual listeners and
music enthusiasts.

1.3. General Objective

To develop a fully functional Musical World application that provides a seamless user
experience for Musical World, playlist management, and music discovery.

 To implement user authentication and authorization.

 To enable users to upload, manage, and play audio files.

 To allow users to create, edit, and delete playlists.

 To provide an administrative interface for managing the application.

1.4. Specific Objectives

1. User Authentication and Authorization:

o Implement a secure system for user registration and login.

o Ensure user data is protected through encryption and secure storage.

2. Music Upload and Management:

o Enable users to upload their own music tracks.

1
Musical World

o Provide an interface for users to manage their uploaded tracks, including


editing and deleting.

3. Playlist Creation and Management:

o Allow users to create, edit, and delete playlists.

o Enable users to add or remove tracks from their playlists.

4. Musical World:

o Develop a robust streaming system that allows users to play music tracks
without interruption.

o Implement buffering and caching mechanisms to ensure smooth playback.

5. User Interface and Experience:

o Design a user-friendly interface that is easy to navigate.

o Ensure the application is responsive and works well on different devices


and screen sizes.

6. Music Discovery:

o Implement features that allow users to discover new music, such as


recommendations based on listening habits.

o Provide search functionality to help users find specific tracks, artists, or


albums.

7. Administrative Control:

o Develop an administrative dashboard for managing the application.

o Provide tools for administrators to manage users, tracks, artists, albums,


and playlists.

o Implement monitoring and reporting tools to track user activity and system
performance.

2
Musical World

8. Security and Privacy:

o Ensure the security and privacy of user data.

o Implement secure login mechanisms and data encryption to protect


sensitive information.

2. Scope and Limitation of the Study

The Scope study focuses on the development of a Musical World application with core
functionalities such as user registration, login, music upload, and playlist management. User
Registration and Authentication implements a system for user sign-up and login and it ensure
secure authentication using standard encryption methods. This system allow users to upload
their own music tracks and provide features for users to create, edit, and delete playlists.
Musical World also allows administrators to manage users, tracks, artists, albums, and
playlists. It also ensure the security of user data through encryption and secure storage
practices.

Limitations of the Study

1. Offline Playback: The application will not support offline playback of music tracks.

2. Real-time Collaborative Playlists: Real-time collaboration on playlists by multiple


users will not be implemented.

3. Advanced AI Features: Advanced AI features for music recommendation, such as


deep learning-based recommendations, will not be included in the initial version.

4. Licensing and Copyright Compliance: The application will not handle complex
licensing and copyright compliance issues beyond basic user-uploaded content
management.

5. Third-party Integrations: Integrations with third-party music services and platforms


(e.g., Spotify, Apple Music) will not be included.

6. High-fidelity Audio Streaming: High-fidelity audio streaming (e.g., FLAC) will not
be supported; the focus will be on standard MP3 streaming.

3
Musical World

7. Geographical Restrictions: The study will not address geographical restrictions and
region-specific content availability.

8. Live Streaming: Live streaming of music events or concerts will not be included.

9. Extensive User Analytics: Detailed user analytics and insights beyond basic activity
logs and reports will not be provided.

10. Comprehensive Mobile Application: A dedicated mobile application will not be


developed as part of this project; the focus will be on a responsive web application.

3. Significance of the Study

3.1. Administrator

The administrator will have control over managing users, tracks, artists, albums, and
playlists. They can also monitor system performance and user activities, ensuring the
platform runs smoothly and efficiently.

3.2. User

Users can enjoy streaming music, creating playlists, and discovering new music
through the application. They can personalize their listening experience and explore
new artists and genres.

4
Musical World

4. Definition of Terms

4.1. Architectural Diagram

An architectural diagram illustrates the components of the Musical World system,


including the client-side, server-side, and database interactions.

4.2. Feasibility

The project is feasible with the available technologies like PHP, MySQL, HTML,
CSS, and JavaScript. The implementation requires a web server and a database server.

4.2.1 Technical Feasibility

 The project utilizes widely-used technologies (PHP, MySQL, HTML, CSS,


JavaScript) that are well-supported and have extensive documentation.The
proposed architecture supports scalability and performance requirements.

4.1.2. Economic Feasibility

5
Musical World

 Open-source technologies are used, reducing software licensing costs.The


project team has the necessary skills, minimizing the need for additional
training or hiring.

4.1.3 Operational Feasibility

 The system addresses a clear need for a Musical World platform with user-
uploaded content. The user-friendly interface and comprehensive features are
expected to meet user expectations and demands.

4.3. Hardware

Standard server hardware capable of handling web traffic and database queries is
required.

4.3.1. Server Specifications

 Processor: Quad-core processor or higher

 Memory: Minimum 8 GB RAM

 Storage: SSD with at least 256 GB for the application and additional
storage for music files

 Network: High-speed internet connection with a minimum


upload/download speed of 100 Mbps

4.3.2. Client Specifications

 Processor: Dual-core processor or higher

 Memory: Minimum 4 GB RAM

 Storage: At least 50 GB free disk space

 Network: Reliable internet connection with a minimum speed of 10 Mbps

4.4. MySQL

6
Musical World

 MySQL is used as the database management system to store user data, track
information, playlists, and other relevant data. MySQL is a relational database
management system and it is open-source. MySQL is ideal for both small and large
applications as it is very fast, reliable, scalable, and easy to use and it supports cross-
platform

4.5. Report

In the context of a music streaming application like Musical World, various reports
can be generated to provide insights into user behavior, system performance, and
music trends. Below are some of the types of reports that can be included:

1. User Reports

o User Registration Report: List of newly registered users within a specified


time period.

o Active Users Report: Users who have logged in and streamed music within
a specified time period.

7
Musical World

o User Activity Report: Detailed activity log for a particular user, including
songs played, playlists created, and interactions with the app.

2. Music Reports

o Top Songs Report: List of the most played songs within a specified time
period.

o Top Artists Report: List of the most popular artists based on the number of
plays.

o Top Genres Report: Breakdown of the most popular music genres among
users.

3. Playlist Reports

o Most Created Playlists: Number of playlists created by users within a


specified time period.

o Top Playlists: Playlists with the most followers or plays.

4.6. Software

The software stack includes PHP for the backend, MySQL for the database,
HTML/CSS for the frontend, and JavaScript for interactivity.

4.6.1. Server-side Software

 Operating System: Linux (Ubuntu or CentOS preferred) or Windows


Server

 Web Server: Apache or Nginx

 Database Server: MySQL or MariaDB

 PHP: Version 7.4 or higher

4.6.2. Client-side Software

 Web Browser: Latest versions of Chrome, Firefox, Safari, or Edge

8
Musical World

 Media Player: Integrated HTML5 audio player

4.6.3. Development Tools

 IDE/Editor: VSCode, PhpStorm, or any preferred code editor.

5. Review of Related Literature

5.1. Background of the Study

The shift from physical media to digital Musical World has revolutionized how music
is consumed. This study leverages this trend to develop an online Musical World
platform that caters to modern listening habits.

5.2. Related System

Existing systems like Spotify, Apple Music, and Amazon Music serve as inspiration,
providing insight into essential features and user expectations. These systems have set
high standards for usability, functionality, and scalability.

5.3. Music Management System

Efficient management of music files, metadata, and user-generated playlists is crucial


for a seamless user experience. The system must handle large volumes of data while
providing quick access to tracks.

5.4. Security and Privacy

Ensuring the security and privacy of user data is paramount. The application will
implement secure login mechanisms, data encryption, and adhere to best practices in
data protection to maintain user trust.

5.5. Artificial Intelligence (AI) in Musical World

AI can enhance user experience by providing personalized music recommendations


and insights into user preferences. Machine learning algorithms can analyse listening
habits to suggest new tracks and artists.

9
Musical World

6. Methodology

The development of the Musical World application will follow an agile methodology,
allowing for iterative progress, continuous feedback, and adaptability to changes in
requirements. Configure the web server and database server for application deployment and
ensure the server environment is secure and optimized for performance.

7. Planning

The planning phase involves requirement gathering, project scheduling, and resource
allocation. Key milestones and deliverables are defined to track progress and ensure timely
completion.

7.1 Project Scheduling

 Develop a project schedule with defined milestones and deadlines.

 Allocate resources and assign tasks to team members.

7.2 Risk Assessment

 Identify potential risks and challenges that may arise during the development
process.

 Develop mitigation strategies to address these risks.

10
Musical World

8. Analysis

System requirements are analyzed to create a detailed project plan, including the technical
stack and architecture. User needs and technical constraints are considered to design a robust
solution.

1. Requirement Analysis

1.1. Functional Requirements

 User Management: Users should be able to register and log in securely. Users
should be able to manage their profiles, including updating personal
information and changing passwords.

o Administrators should be able to manage users, including creating,


updating, and deleting user accounts.

 Music Management: Users should be able to upload music tracks. Users


should be able to edit and delete their uploaded tracks. Administrators
should be able to manage all uploaded tracks.

 Playlist Management: Users should be able to create, edit, and delete


playlists. Users should be able to add or remove tracks from their playlists.

 Musical World: Users should be able to stream music tracks seamlessly.


Users should have control over playback features such as play, pause, next,
and previous.

 Music Discovery: Users should receive music recommendations based on


their listening habits. Users should be able to search for tracks, artists, and
albums.

 Administrative Functions: Administrators should have access to a


dashboard to manage users, tracks, artists, albums, and playlists.

11
Musical World

Administrators should have tools to monitor user activity and system


performance.

1.2. Non-Functional Requirements

 Security: The system should use encryption to protect user data. Secure
authentication mechanisms should be implemented to prevent
unauthorized access.

 Performance: The system should handle a large number of concurrent


users without performance degradation. Musical World should be smooth
and uninterrupted.

 Scalability: The system should be designed to scale horizontally to


accommodate future growth. The database should support efficient
querying and data management.

 Usability: The user interface should be intuitive and easy to navigate. The
application should be responsive and accessible on various devices.

 Reliability: The system should have minimal downtime and be highly


available. Backup and recovery mechanisms should be in place to protect
data integrity.

12
Musical World

9. Designing

Designing the user interface and system architecture to ensure a user-friendly experience and
robust backend. Wireframes and mockups are created to visualize the application layout.

Fig: Login activity diagram for Musical World

13
Musical World

10. Software Development

10.1. Coding

Implementation of the application features using PHP, MySQL, HTML, CSS, and
JavaScript. Code is written following best practices and coding standards.

10.2. Testing

Testing the application for functionality, performance, and security. Both automated
and manual testing methods are used to identify and fix bugs.

10.3. Operation

Deploying the application on a web server for user access. The deployment process
includes setting up the server environment and configuring the application.

10.4. Maintenance

Regular updates and maintenance to fix bugs and introduce new features. Ongoing
support ensures the application remains functional and up-to-date.

10.5. Operating System

The application can be hosted on any server running a compatible operating system,
typically Linux or Windows Server.

14
Musical World

11. Architectural Diagram Interface of Hardware

A visual representation of the hardware components and their interactions within the system.
This diagram helps in understanding the overall system architecture and how different
components communicate.

12. System Testing and Implementation

System Testing

15
Musical World

System testing is a critical phase in the software development lifecycle. It ensures that the
Musical World application functions correctly and meets all specified requirements. Below
are the types of testing and their respective goals:

1. Unit Testing

o Objective: Verify that individual components or functions work as intended.

o Tools: PHPUnit for PHP.

o Examples: Testing functions like user authentication, track retrieval, and


playlist creation.

2. Integration Testing

o Objective: Ensure that different modules and components work together


seamlessly.

o Tools: PHPUnit, Postman for API testing.

o Examples: Testing interactions between the user interface and backend API,
database interactions.

3. System Testing

o Objective: Validate the complete and integrated application against the


requirements.

o Examples: Full workflow testing from user registration, login, music playback,
and playlist management.

4. Performance Testing

o Objective: Assess the application's performance under load.

o Examples: Testing how the application handles multiple simultaneous users


streaming music.

5. Security Testing

o Objective: Identify vulnerabilities and ensure data protection.

o Examples: Testing for SQL injection, XSS, and CSRF vulnerabilities.

16
Musical World

6. Usability Testing

o Objective: Evaluate the user interface and user experience.

o Examples: Testing navigation, accessibility, and overall user satisfaction.

Implementation

Implementation involves deploying the application in a live environment where users can
access and use it. This phase includes several steps:

1. Deployment Preparation : Ensure that the code is clean, well-documented, and


adheres to coding standards. Prepare the production environment, including servers,
databases, and necessary software.

2. Deployment Steps : Set up web servers (Apache/Nginx), application servers, and


database servers. Apply database schema changes and migrate data if necessary.

3. Post-Deployment Testing :Access the application via a web browser and perform
smoke tests to ensure basic functionality. Monitor server logs for any errors or
warnings.

13. Musical World Features

13.1. Recommended Hardware Specification (Server/Work Stations)

 Processor: Intel Xeon or equivalent

 RAM: 8GB or higher

 Storage: SSD with at least 500GB capacity.

13.2. Recommended Software Specification (Server/Work Stations)

 Operating System: Linux (Ubuntu) or Windows Server

 Web Server: Apache or Nginx

17
Musical World

 Database Server: MySQL

13.3. Recommended Network Specification

A stable and high-speed internet connection to handle streaming traffic.

14. Existing System

The existing Musical World systems provide a broad range of functionalities that cater to
diverse user needs. These systems have set high standards in terms of user experience,
content variety, and technological innovations. Some of the prominent Musical World
platforms include Spotify, Apple Music, JioSaavn, and Amazon Music. Each of these
platforms offers unique features and services that attract millions of users worldwide.

18
Musical World

15. ER Model of Musical World

Entity-Relationship diagram representing the database schema and relationships between


entities. This model helps in designing the database structure.

19
Musical World

16. Proposed System

The proposed system aims to develop a robust and scalable Musical World application using
PHP and MySQL. The application will offer a seamless user experience, allowing users to
stream music, create playlists, discover new tracks, and manage their profiles. The system
will incorporate advanced features for personalization, social interaction, and security to
enhance user engagement and data protection. Users can update their profile information,
such as username, email, and profile picture. Information about albums and artists, linked to
their respective tracks. Users can add tracks to their playlists and organize them. An
integrated audio player with play, pause, skip, and volume controls. Users can manage the
playback queue and control the order of tracks, search functionality and recommendations:
personalized recommendations based on user preferences and listening history. admin
dashboard used for user management, content management and analytics: view usage
statistics and user engagement metrics.

17.Code for Musical World

17.1 index.php

<?php

include './partials/dbConnect.php';

session_start();

if(isset($_SESSION['user_id'])){

$id=$_SESSION['user_id'];

$sql="SELECT * FROM users where id='$id'";

$result=mysqli_query($conn,$sql);

$row=mysqli_fetch_assoc($result);

$is_admin = $row['is_admin'];

20
Musical World

if($is_admin == "0"){

header('location: ./home.php');

else{

header('location: ./admin/admin.php');

}} ?>

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Musical World | Dance to Music</title>

<link rel="shortcut icon" href="img/icons/purple-play-button.png" type="image/x-


icon">

<link rel="stylesheet" href="master.css">

<link rel="stylesheet" href="style.css">

</head>

<body>

<img src="img/gif/saving-animation.gif" alt="" class="colorWave">

<div class="container">

<div class="header">

<a href="">MusicalWorld</a>

21
Musical World

<p>Musical World is a digital music service that gives you access to millions
of songs.</p>

</div>

<div class="btns">

<a href="login.php" id="loginBtn">Log in</a>

<a href="signup.php" id="signupBtn">Sign up</a>

</div>

</div>

</body>

</html>

17.2 login.php

<?php

include './partials/dbConnect.php';

session_start();

if(isset($_SESSION['user_id'])){

$id=$_SESSION['user_id'];

$sql="SELECT * FROM users where id='$id'";

$result=mysqli_query($conn,$sql);

$row=mysqli_fetch_assoc($result);

$is_admin = $row['is_admin'];

if($is_admin == "0"){

header('location: ./home.php');

22
Musical World

else{

header('location: ./admin/admin.php');

$showError = false;

if($_SERVER['REQUEST_METHOD'] == 'POST'){

$email = $_POST['email'];

$password = $_POST['password'];

// Search the email of the user in the table

$sql="SELECT * FROM users where email='$email'";

$result=mysqli_query($conn,$sql); // execute the query

$numOfRows=mysqli_num_rows($result); // returns number of rows


from the result

// if no email matches

if($numOfRows==0)

$errMsg = 'User not registered';

$showError = true;

// if email matches

else{

// match the passwords

$row=mysqli_fetch_assoc($result);

23
Musical World

$isAdmin = $row['is_admin'];

// match the password with hash code

if(password_verify($password, $row['password'])){

session_start();

$_SESSION['user_id'] = $row['id'];

if($isAdmin == "0"){

$_SESSION['played_songs'] = array();

header("location: home.php");

else{

header("location: admin/admin.php");

else{

$errMsg = 'Password incorrect';

$showError = true;

?>

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

24
Musical World

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Musical World - Login</title>

<link rel="shortcut icon" href="img/icons/purple-play-button.png" type="image/x-


icon">

<link rel="stylesheet" href="master.css">

<link rel="stylesheet" href="css/login.css">

</head>

<body>

<?php

if($showError){

echo '

<div class="alert">

<p class="danger"><span>Alert!</span> '.$errMsg.'!</p>

</div>

';

?>

<div class="login">

<div class="logo">

<a href=""><img src="img/icons/purple-play-button.png" alt=""> Musical


World</a>

</div>

<form action="" method="post">

<div class="inputItem">

25
Musical World

<label for="email">Email</label>

<input type="email" placeholder="email@example.com" name="email">

</div>

<div class="inputItem">

<label for="password">Password</label>

<input type="password" placeholder="password" name="password">

</div>

<!-- <div>

<input type="checkbox" name="remember">

<label for="remember">Remember me</label>

</div>

<a href="">Forgot Password</a> -->

<button type="submit">Login</button>

</form>

</div>

</body>

</html>

17.3 admin.php

<?php

include '../partials/dbConnect.php';

session_start();

$user_id = $_SESSION['user_id'];

if($user_id == NULL){

header('location: ../login.php');

26
Musical World

?>

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Musical World - Admin Dashboard</title>

<link rel="shortcut icon" href="../img/icons/purple-play-button.png"


type="image/x-icon">

<link rel="stylesheet" href="../master.css">

<link rel="stylesheet" href="../css/admin.css">

<scriptsrc="https://kit.fontawesome.com/a165e4dd2f.js"
crossorigin="anonymous"></script>

</head>

<body>

<nav>

<div class="logo">

<a href="">

<img src="../img/icons/purple-play-button.png" alt="">

Musical World

</a>

</div>

<div class="userAccount">

27
Musical World

<div class="accountIcon">

<i class="fas fa-user"></i>

<?php

$userQry = "SELECT * FROM users WHERE id='$user_id'";

$userResult = mysqli_query($conn, $userQry);

$userRow = mysqli_fetch_assoc($userResult);

$fname = $userRow['fname'];

$lname = $userRow['lname'];

?>

<span id="userName"><?php echo $fname.' '.$lname ?></span>

</div>

<a href="../logout.php">Logout</a>

</div>

</nav>

<main>

<div class="sidebar">

<ul>

<li class="active"><a href="admin.php"><i class="fas fa-star"></i>


Dashboard</a></li>

<li class=""><a href="albums.php"><i class="fas fa-star"></i>


Albums</a></li>

<li class=""><a href="artists.php"><i class="fas fa-star"></i>


Artists</a></li>

<li class=""><a href="genre.php"><i class="fas fa-star"></i>


Genre</a></li>

28
Musical World

<li class=""><a href="tracks.php"><i class="fas fa-star"></i>


Tracks</a></li>

<li class=""><a href="playlists.php"><i class="fas fa-star"></i>


Playlists</a></li>

</ul>

</div>

<div class="mainContent">

<div class="contentHeader">

<div class="headerTitle">Dashboard</div>

<div class="actionBtns">

</div>

</div>

<div class="allContents">

<?php

$qry = "SELECT COUNT(*) AS total_rows FROM tracks";

$result = mysqli_query($conn, $qry);

$row = mysqli_fetch_assoc($result);

$totalTracks = $row['total_rows'];

?>

<div class="cards">

<div class="cardFigure"><?php echo $totalTracks; ?></div>

<div class="cardTitle">Tracks</div>

</div>

<?php

29
Musical World

$qry = "SELECT COUNT(*) AS total_rows FROM albums";

$result = mysqli_query($conn, $qry);

$row = mysqli_fetch_assoc($result);

$totalAlbums = $row['total_rows'];

?>

<div class="cards">

<div class="cardFigure"><?php echo $totalAlbums; ?></div>

<div class="cardTitle">Albums</div>

</div>

<?php

$qry = "SELECT COUNT(*) AS total_rows FROM artists";

$result = mysqli_query($conn, $qry);

$row = mysqli_fetch_assoc($result);

$totalArtists = $row['total_rows'];

?>

<div class="cards">

<div class="cardFigure"><?php echo $totalArtists; ?></div>

<div class="cardTitle">Artists</div>

</div>

<?php

$qry = "SELECT COUNT(*) AS total_rows FROM genre";

$result = mysqli_query($conn, $qry);

$row = mysqli_fetch_assoc($result);

$totalGenre = $row['total_rows'];

30
Musical World

?>

<div class="cards">

<div class="cardFigure"><?php echo $totalGenre; ?></div>

<div class="cardTitle">Genre</div>

</div>

<?php

$qry = "SELECT COUNT(*) AS total_rows FROM playlists";

$result = mysqli_query($conn, $qry);

$row = mysqli_fetch_assoc($result);

$totalPlaylists = $row['total_rows'];

?>

<div class="cards">

<div class="cardFigure"><?php echo $totalPlaylists; ?></div>

<div class="cardTitle">Playlists</div>

</div>

</div>

</div>

</main>

</body>

</html>

17.4 createplaylist.php

<?php

include '../partials/dbConnect.php';

session_start();

31
Musical World

$user_id = $_SESSION['user_id'];

$playlist_title = $_POST['title'];

$qry = "INSERT INTO playlists (title) VALUES ('$playlist_title')";

$result = mysqli_query($conn, $qry);

// GET NEWLY CREATED PLAYLIST ID

$qry1 = "SELECT * FROM playlists WHERE title = '$playlist_title'";

$result1 = mysqli_query($conn, $qry1);

$row1 = mysqli_fetch_assoc($result1);

$playlist_id = $row1['id'];

// INSERT INTO PLAYLIST USER

$qry2 = "INSERT INTO playlist_user (playlist_id, user_id) VALUES


('$playlist_id', '$user_id')";

$result2 = mysqli_query($conn, $qry2);

if($result && $result1 && $result2){

// Send a response back to the JavaScript

$response = array('status' => 'success');

echo json_encode($response);

else{

// Send a response back to the JavaScript

$response = array('status' => 'failed');

echo json_encode($response);

?>

32
Musical World

17.5 deletefromplaylist.php

<?php

include '../partials/dbConnect.php';

$track_id = $_GET['track_id'];

$playlist_id = $_GET['playlist_id'];

$qry = "DELETE FROM playlist_track WHERE playlist_id='$playlist_id' AND


track_id='$track_id'";

$result = mysqli_query($conn, $qry);

if($result){

// Send a response back to the JavaScript

$response = array('status' => 'success');

echo json_encode($response);

else{

// Send a response back to the JavaScript

$response = array('status' => 'failed');

echo json_encode($response);

?>

17.6 editalbums.php

<?php

include 'dbConnect.php';

session_start();

$user_id = $_SESSION['user_id'];

33
Musical World

if($user_id == NULL){

header('location: ../login.php');

if($_SERVER['REQUEST_METHOD']=='POST'&&isset($_POST['updateAlbumBtn'])){

// GET VALUES FROM FORM DATA

$album_id = $_POST['albumId'];

$title = $_POST['albumTitle'];

$year = $_POST['albumYear'];

if(!empty($_FILES['cover']['name'])){

$uniqueFileName = time() . '_' . uniqid() . '.jpeg';

$cover = "./uploads/albumCover/" . $uniqueFileName;

$qry = "UPDATE albums SET cover='$cover' WHERE id='$album_id'";

mysqli_query($conn, $qry);

$file_tmp = $_FILES['cover']['tmp_name'];

// Move the uploaded file to a desired directory

move_uploaded_file($file_tmp, "../uploads/albumCover/" .
$uniqueFileName);

// UPDATE ALBUM

$qry = "UPDATE albums SET title='$title', year='$year' WHERE


id='$album_id'";

mysqli_query($conn, $qry);

header('location: ../admin/editAlbum.php?id='.$album_id);

34
Musical World

?>

17.7 loadnexttrack.php

<?php

include '../partials/dbConnect.php';

session_start();

$year = $_GET['year'];

$genre = 1;

$sql = "SELECT t.*, a.name FROM tracks t JOIN artist_track at ON t.id =


at.track_id JOIN artists a ON at.artist_id = a.id WHERE t.year = '$year' AND
t.genre='$genre'";

// Execute the query

$result = mysqli_query($conn, $sql);

// Check if any results were found

if ($result->num_rows > 0) {

// Fetch the results and store them in an array

$tracks = array();

while ($row = $result->fetch_assoc()) {

$tracks[] = $row;

// Set the response content type to JSON

header('Content-Type: application/json');

// Send the JSON-encoded search results as the API response

35
Musical World

echo json_encode($tracks);

} else {

// No results found

echo 'No results found.';

// Close the database connection

$conn->close();

?>

17.8 editplaylist.php

<?php

include '../partials/dbConnect.php';

session_start();

$user_id = $_SESSION['user_id'];

if($user_id == NULL){

header('location: ../login.php');

?>

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Musical World - Admin Dashboard</title>

36
Musical World

<link rel="shortcut icon" href="../img/icons/purple-play-button.png"


type="image/x-icon">

<link rel="stylesheet" href="../master.css">

<link rel="stylesheet" href="../css/admin.css">

<scriptsrc="https://kit.fontawesome.com/a165e4dd2f.js"crossorigin="anonymous">

</script>

</head>

<body>

<nav><div class="logo">

<a href="">

<img src="../img/icons/purple-play-button.png" alt="">

Musical World

</a>

</div>

<div class="userAccount">

<div class="accountIcon">

<i class="fas fa-user"></i>

<?php

$userQry = "SELECT * FROM users WHERE id='$user_id'";

$userResult = mysqli_query($conn, $userQry);

$userRow = mysqli_fetch_assoc($userResult);

$fname = $userRow['fname'];

$lname = $userRow['lname']; ?>

<span id="userName"><?php echo $fname.' '.$lname ?></span>

37
Musical World

</div>

<a href="../logout.php">Logout</a>

</div>

</nav>

<main>

<div class="sidebar">

<ul>

<li class=""><a href="admin.php"><i class="fas fa-star"></i> Dashboard

</a></li>

<li class=""><a href="albums.php"><i class="fas fa-star"></i> Albums

</a></li>

<li class=""><a href="artists.php"><i class="fas fa-star"></i> Artists

</a></li>

<li class=""><a href="genre.php"><i class="fas fa-star"></i> Genr

e</a></li>

<li class=""><a href="tracks.php"><i class="fas fa-star"></i> Tracks

</a></li>

<li class="active"><a href="playlists.php"><i class="fas fa-star"></i>


Playlists</a></li>

</ul> </div>

<div class="mainContent">

<div class="contentHeader">

<div class="headerTitle">Edit Playlist</div>

<div class="actionBtns">

38
Musical World

<a href="./createPlaylist.php">Create Playlist</a>

</div> </div>

<div class="allContents">

<form action="" method="post">

<?php

$playlist_id = $_GET["id"];

$qry = "SELECT * FROM playlists WHERE id='$playlist_id'";

$result = mysqli_query($conn, $qry);

$row = mysqli_fetch_assoc($result);

$playlist_title = $row['title'];

$playlist_cover = $row['cover']; ?>

<img src=".<?php echo $playlist_cover; ?>" alt="" id="playlistCover">

<div class="formItem">

<label for="albumId">ID</label>

<input type="text" value="<?php echo $playlist_id; ?>" disabled>

</div>

<div class="formItem">

<label for="albumTitle">Title</label>

<input type="text" value="<?php echo $playlist_title; ?>">

</div>

<div class="formItem">

<label for="albumTitle">Cover Photo</label>

39
Musical World

<inputtype="file"accept="image/
*"onchange="document.getElementById('playlistCover').src =
window.URL.createObjectURL(this.files[0])">

</div>

<div class="actionBtns">

<button type="submit">Update</button>

<a href="playlists.php">Cancel</a>

</div>

</form>

</div>

</div>

</main>

</body></html>

40
Musical World

17.Screenshots of the project

17.1 Dashboard of Musical World

17.2 Login Page

41
Musical World

17.3 SignUp Page

17.4 User Dashboard

42
Musical World

17.5 Create Playlist (User)

17.6 Add to Playlist(User)

43
Musical World

17.7 Search tab(user)

17.8 Login (Admin)

44
Musical World

17.9 Admin Dashboard

17.10 Add Album

45
Musical World

17.11 Create Artist

46
Musical World

17.12 Create Genre

17.13 Create a new track

47
Musical World

18. Conclusion and Recommendation

The development of a Musical World application using PHP and MySQL involves various
stages, including planning, design, development, and testing. The project aimed to create a
robust platform that allows users to stream music, create playlists, manage their profiles, and
discover new music. The application includes essential features such as user registration,
login, music playback, playlist management, and admin functionalities and the use of PHP for
backend development and MySQL for database management has proven effective in handling
the application’s requirements. The application incorporates essential security measures, such
as data encryption, user authentication, input validation, and role-based access control. The
user interface was designed to be intuitive and user-friendly, enhancing the overall user
experience.

Recommendation

48
Musical World

Based on the project's outcomes and the insights gained during development, the following
recommendations can enhance the application's functionality, performance, and user
satisfaction. Implement advanced algorithms using machine learning to provide personalized
music recommendations based on user preferences and listening history. Utilize cloud
services for flexible and scalable infrastructure management. Services like AWS, Google
Cloud, or Azure can provide resources on-demand.

18. Reference

1. www.google.com

2. www.youtube.com

3. www.stackoveflow.com

4. www.github.com

5. www.tutorialspoint.com

49

You might also like