0% found this document useful (0 votes)
7 views51 pages

Websyspapers

The document consists of PHP scripts for a web application that includes user login, registration, and a dashboard for managing songs and players. It features a login form that checks credentials against a database, a registration form that ensures unique usernames, and a dashboard with navigation links for various functionalities. The application employs session management to maintain user authentication and provides a responsive design using CSS for a user-friendly interface.
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)
7 views51 pages

Websyspapers

The document consists of PHP scripts for a web application that includes user login, registration, and a dashboard for managing songs and players. It features a login form that checks credentials against a database, a registration form that ensures unique usernames, and a dashboard with navigation links for various functionalities. The application employs session management to maintain user authentication and provides a responsive design using CSS for a user-friendly interface.
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/ 51

login.

php
<?php
session_start();
include 'php_con.php';

if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST['username'];
$password = $_POST['password'];

$sql = "SELECT * FROM admin WHERE username='$username' AND password='$password'";


$result = $conn->query($sql);

if ($result->num_rows > 0) {
$_SESSION['username'] = $username;
header("Location: index2.php");
} else {
// echo "Invalid username or password";
// echo '<script>alert("Invalid username or password");</script>';
$error = "Invalid username or password";
}
}
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>P a W Management</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
/* background-image: url('img/Alogo.jpg'); */
/* background-size: cover;
background-position: center; */
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url(img/Alogo.jpg);
background-repeat: no-repeat;
background-position: center;
}

form {
background-color: #bb8c44;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

label {
display: block;
margin-bottom: 8px;
}

input {
width: 100%;
padding: 8px;
margin-bottom: 16px;
box-sizing: border-box;
}

input[type="submit"] {
background-color: #4caf50;
color: #fff;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #45a049;
}
/*
.register-button {
display: inline-block;
background-color: #4caf50;
color: #fff;
text-align: center;
padding: 10px;
text-decoration: none;
border-radius: 4px;
width: 100%;
box-sizing: border-box;
}

.register-button:hover {
background-color: #45a049;
} */
.register-button {
display: inline;
color: white;
text-decoration: none;
padding: 0;
margin-top: 10px;
display: inline-block;
}

.register-button:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container">
<!-- <h2>Log In</h2> -->
<form action="" method="POST">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="Log In" class="log-in-button">
<?php if (!empty($error)) : ?>
<div class="error-message"><?php echo $error; ?></div>
<?php endif; ?>
<br>
<a href="register.php" class="register-button">Register</a>
<!-- <input type="submit" value="Register" href="register.php"> -->
</form>
</div>
</body>
</html>
Register.php
<?php
include 'php_con.php';

if ($_SERVER["REQUEST_METHOD"] == "POST") {
$new_username = $_POST['new_username'];
$new_midname = $_POST['new_midname'];
$new_lname = $_POST['new_lname'];
$new_password = $_POST['new_password'];

// Prepare the SQL statement to check if the username, middle name, and last name already exist
$stmt = $conn->prepare("SELECT * FROM admin WHERE username = ? AND midname = ? AND lname = ?");
$stmt->bind_param("sss", $new_username, $new_midname, $new_lname);
$stmt->execute();
$result = $stmt->get_result();

// Check if any rows are returned


if ($result->num_rows > 0) {
echo '<script>alert("Username already exists. Please choose a different username.");</script>';
echo '<script>window.history.back();</script>';
exit();
}

// If the username, middle name, and last name are unique, proceed with insertion
$sql = "INSERT INTO admin (username, midname, lname, password) VALUES (?, ?, ?, ?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ssss", $new_username, $new_midname, $new_lname, $new_password);

// Execute the prepared statement


if ($stmt->execute()) {
header("Location: login.php?registration=success");
exit();
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Register - P a W Management</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
/* background-image: url('img/Alogo.jpg');
background-size: cover;
background-position: center; */
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url(img/Alogo.jpg);
background-repeat: no-repeat;
background-position: center;
}

.container {
background-color: #bb8c44;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 100%;
}

label {
display: block;
margin-bottom: 8px;
}

input {
width: 100%;
padding: 8px;
margin-bottom: 16px;
box-sizing: border-box;
}

input[type="submit"] {
background-color: #4caf50;
color: #fff;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #45a049;
}
.return-button {
display: inline;
color: white;
text-decoration: none;
padding: 0;
margin-top: 10px;
display: inline-block;
}

.return-button:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container">
<h2>Register</h2>
<form action="" method="POST">
<label for="new_username">Username:</label>
<input type="text" id="new_username" name="new_username" required>
<label for="new_username">Middlename:</label>
<input type="text" id="new_midname" name="new_midname" required>
<label for="new_username">Lastname:</label>
<input type="text" id="new_lname" name="new_lname" required>
<label for="new_password">Password:</label>
<input type="password" id="new_password" name="new_password" required>
<input type="submit" value="Register">
<a href="login.php" class="return-button">Return</a>
</form>
</div>
</body>
</html>
Index.php/Dashboard.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap">
<link rel="stylesheet" href="sidebar.css">
<title>P a W Management</title>
</head>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}

body{
height: 100v;
width: 100%;
background: whitesmoke;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
/* background-image: url('img/Alogo.jpg');
background-size: cover;
background-position: center; */
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url(img/Alogo.jpg);
background-repeat: no-repeat;
background-position: center;
}

.sidebar{
position: fixed;
left: 0;
top: 0;
height: 100%;
width: 225px;
background: white;
display: flex;
align-items: center;
flex-direction: column;
border-right: 1px solid rgba(255, 255, 255, 0.7);
/* transition: width 0.32 ease; */
}

/* .sidebar:hover{
width: 260px;
} */

.links h4{
color: #222;
font-weight: 500;
display: none;
margin-bottom: 10px;
}
.sidebar:hover .links h4{
display: block;
}

.links hr{
margin: 10px 8px;
border: 1px solid #4c4c4c;
}

.sidebar: hover .links hr{


border-color: transparent;
}

.links li{
display: flex;
align-items: center;
margin-bottom: 10px;
}

.links li i{
padding: 0px 0px;
font-size: 28px;
margin-bottom: 0px;
margin-right: 10px;
}

.links li a{
padding: 10px;
color: #000;
display: none;
font-weight: 500;
white-space: nowrap;
text-decoration: none;
display: block;
}

.sidebar:hover .links li a{
display: block;
}

.links .logout-link{
margin-top: 20px
}

.links .logout-link{
background-color: navajowhite;
}

.Welcome{
margin-top: 20px;
text-align: center;
}
.Welcome{
color: white;
}
</style>
<?php
session_start();
if (!isset($_SESSION['username'])) {
header("Location: login.php");
}
include 'php_con.php';
?>

<body>
<aside class="sidebar">
<div class="logo">
<img src="./img/download.jpg" alt="logo">
<!-- <h2>Church Management</h2> -->
</div>
<ul class="links">
<!-- <h4>DASHBOARD</h4> -->
<li>
<i class="ri-home-4-line"></i>
<a href="index2.php">Home</a>
</li>
<li>
<i class="ri-mail-open-line"></i>
<a href="readsong.php">Songs</a>
</li>
<li>
<i class="ri-account-circle-line"></i>
<a href="readplayer.php">Players</a>
</li>
<li>
<i class="ri-file-chart-line"></i>
<a href="readlineup.php">Line-Ups</a>
</li>
<!-- <li>
<i class="ri-book-read-line"></i>
<a href="#">History</a>
</li> -->
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<li>
<i class="ri-account-circle-line"></i>
<a href="logout.php">Log-out</a>
</li>
</ul>
</aside>
<div class="Welcome">
<h1>Welcome to Praise and Worship Management!<br>You are logged in as <?php echo $_SESSION['username']; ?></h1>
</div>
</body>
</html>
Readsong.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="sidebar.css">
<title>Songs List</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}

body{
height: 100v;
width: 100%;
background: whitesmoke;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
/* background-image: url('img/Alogo.jpg');
background-size: cover;
background-position: center; */
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url(img/Alogo.jpg);
background-repeat: no-repeat;
background-position: center;
}

.sidebar{
position: fixed;
left: 0;
top: 0;
height: 100%;
width: 225px;
background: white;
display: flex;
align-items: center;
flex-direction: column;
border-right: 1px solid rgba(255, 255, 255, 0.7);
/* transition: width 0.32 ease; */
}

/* .sidebar:hover{
width: 260px;
} */

.links h4{
color: #222;
font-weight: 500;
display: none;
margin-bottom: 10px;
}
.sidebar:hover .links h4{
display: block;
}

.links hr{
margin: 10px 8px;
border: 1px solid #4c4c4c;
}

.sidebar: hover .links hr{


border-color: transparent;
}

.links li{
display: flex;
align-items: center;
margin-bottom: 10px;
}

.links li i{
padding: 0px 0px;
font-size: 28px;
margin-bottom: 0px;
margin-right: 10px;
}

.links li a{
padding: 10px;
color: #000;
display: none;
font-weight: 500;
white-space: nowrap;
text-decoration: none;
display: block;
}

.sidebar:hover .links li a{
display: block;
}

.links .logout-link{
margin-top: 20px
}

.links .logout-link{
background-color: navajowhite;
}

.Welcome{
margin-top: 20px;
text-align: center;
}
.Welcome{
color: white;
}

.container {
margin-top: 60px;
background: rgba(255, 255, 255, 0.9);
padding: 20px;
border-radius: 10px;
max-width: 800px;
width: 100%;
}
h2 {
margin-bottom: 20px;
color: #222;
text-align: center;
}

table {
width: 100%;
margin-bottom: 20px;
border-collapse: collapse;
}

th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}

th {
background-color: #f2f2f2;
color: #333;
}

tr:hover {
background-color: #f5f5f5;
}

a{
text-decoration: none;
color: #007bff;
}

a:hover {
color: #0056b3;
}

a.btn-add {
display: inline-block;
padding: 10px 20px;
margin-bottom: 20px;
font-size: 16px;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 5px;
text-decoration: none;
}

a.btn-add:hover {
background-color: #0056b3;
}

</style>
</head>
<body>
<aside class="sidebar">
<div class="logo">
<img src="./img/download.jpg" alt="logo">
</div>
<ul class="links">
<li>
<i class="ri-home-4-line"></i>
<a href="index2.php">Home</a>
</li>
<li>
<i class="ri-mail-open-line"></i>
<a href="readsong.php">Songs</a>
</li>
<li>
<i class="ri-account-circle-line"></i>
<a href="readplayer.php">Players</a>
</li>
<li>
<i class="ri-file-chart-line"></i>
<a href="readlineup.php">Line-Ups</a>
</li>
<!-- <li>
<i class="ri-book-read-line"></i>
<a href="#">History</a>
</li> -->
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<li>
<i class="ri-account-circle-line"></i>
<a href="logout.php">Log-out</a>
</li>
</ul>
</aside>
<div class="container">
<h2>Songs List</h2>
<a class="btn-add" href="addsong.php">Add New Song</a>
<table>
<tr>
<th>ID</th>
<th>Title</th>
<th>Artist</th>
<th>Lyrics</th>
</tr>
<?php
include 'php_con.php';

$sql = "SELECT * FROM line_up";


$result = $conn->query($sql);

if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr>
<td>" . $row["date"] . "</td>
<td>" . $row["chords"] . "</td>
<td>";

// Check if lyrics link ends with .pdf or .docx


// $is_pdf = strpos($row["lyrics"], '.pdf') !== false;
// $is_docx = strpos($row["lyrics"], '.docx') !== false;

// if ($is_pdf || $is_docx) {
// echo "<a href='" . $row["lyrics"] . "' target='_blank' download>Download</a>";
// } else {
// echo "<a href='" . $row["lyrics"] . "' target='_blank'>" . $row["lyrics"] . "</a>";
// }
$url = 'lineup1.pdf';
$linkText = 'Lineup';
echo '<p><a href="' . $url . '" target="_blank">' . $linkText . '</a></p>';

echo "</td>
<td>" . $row["add_newlineup"] . "</td>
<td>

</td>
</tr>";
}
} else {
echo "<tr><td colspan='5'>No records found</td></tr>";
}
$conn->close();
?>
</table>
</div>
</body>
</html>
Addsong.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="sidebar.css">
<title>Create Song</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}

body{
height: 100v;
width: 100%;
background: whitesmoke;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
/* background-image: url('img/Alogo.jpg');
background-size: cover;
background-position: center; */
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url(img/Alogo.jpg);
background-repeat: no-repeat;
background-position: center;
}

.sidebar{
position: fixed;
left: 0;
top: 0;
height: 100%;
width: 225px;
background: white;
display: flex;
align-items: center;
flex-direction: column;
border-right: 1px solid rgba(255, 255, 255, 0.7);
/* transition: width 0.32 ease; */
}

/* .sidebar:hover{
width: 260px;
} */

.links h4{
color: #222;
font-weight: 500;
display: none;
margin-bottom: 10px;
}
.sidebar:hover .links h4{
display: block;
}

.links hr{
margin: 10px 8px;
border: 1px solid #4c4c4c;
}

.sidebar: hover .links hr{


border-color: transparent;
}

.links li{
display: flex;
align-items: center;
margin-bottom: 10px;
}

.links li i{
padding: 0px 0px;
font-size: 28px;
margin-bottom: 0px;
margin-right: 10px;
}

.links li a{
padding: 10px;
color: #000;
display: none;
font-weight: 500;
white-space: nowrap;
text-decoration: none;
display: block;
}

.sidebar:hover .links li a{
display: block;
}

.links .logout-link{
margin-top: 20px
}

.links .logout-link{
background-color: navajowhite;
}

.Welcome{
margin-top: 20px;
text-align: center;
}
.Welcome{
color: white;
}

.container {
margin-top: 60px;
background: rgba(255, 255, 255, 0.9);
padding: 20px;
border-radius: 10px;
max-width: 500px;
width: 100%;
}
h2 {
margin-bottom: 20px;
color: #222;
text-align: center;
}

label {
margin-top: 10px;
}

input[type="text"] {
width: 100%;
padding: 10px;
margin: 5px 0 20px;
border: 1px solid #ddd;
border-radius: 5px;
}

input[type="submit"] {
display: inline-block;
width: 100%;
padding: 10px 20px;
font-size: 16px;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 5px;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #0056b3;
}

.btn-back {
display: inline-block;
margin-top: 20px;
padding: 10px 20px;
font-size: 16px;
color: #007bff;
background-color: transparent;
border: none;
border-radius: 5px;
text-decoration: none;
}

.btn-back:hover {
color: #0056b3;
}
</style>
</head>
<body>
<aside class="sidebar">
<div class="logo">
<img src="./img/download.jpg" alt="logo">
</div>
<ul class="links">
<li>
<i class="ri-home-4-line"></i>
<a href="index2.php">Home</a>
</li>
<li>
<i class="ri-mail-open-line"></i>
<a href="readsong.php">Songs</a>
</li>
<li>
<i class="ri-account-circle-line"></i>
<a href="readplayer.php">Players</a>
</li>
<li>
<i class="ri-file-chart-line"></i>
<a href="readlineup.php">Line-Ups</a>
</li>
<!-- <li>
<i class="ri-book-read-line"></i>
<a href="#">History</a>
</li> -->
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<li>
<i class="ri-account-circle-line"></i>
<a href="logout.php">Log-out</a>
</li>
</ul>
</aside>
<div class="container">
<h2>Create Song</h2>
<form method="post" action="insertsong.php">
<label for="title">Title:</label><br>
<input type="text" id="title" name="title"><br>
<label for="artist">Artist:</label><br>
<input type="text" id="artist" name="artist"><br>
<label for="lyrics">Lyrics:</label><br>
<input type="text" id="lyrics" name="lyrics"><br><br>
<input type="submit" value="Submit">
</form>
<br>
<a class="btn-back" href="readsong.php">Back to Songs List</a>
</div>
</body>
</html>
Player.php
<?php
session_start();
if (!isset($_SESSION['username'])) {
header("Location: login.php");
}
include 'php_con.php';
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap">
<link rel="stylesheet" href="sidebar.css">
<title>Players</title>
</head>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}

body{
height: 100v;
width: 100%;
background: whitesmoke;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
/* background-image: url('img/Alogo.jpg');
background-size: cover;
background-position: center; */
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url(img/Alogo.jpg);
background-repeat: no-repeat;
background-position: center;
}

.sidebar{
position: fixed;
left: 0;
top: 0;
height: 100%;
width: 225px;
background: white;
display: flex;
align-items: center;
flex-direction: column;
border-right: 1px solid rgba(255, 255, 255, 0.7);
/* transition: width 0.32 ease; */
}

/* .sidebar:hover{
width: 260px;
} */
.links h4{
color: #222;
font-weight: 500;
display: none;
margin-bottom: 10px;
}

.sidebar:hover .links h4{


display: block;
}

.links hr{
margin: 10px 8px;
border: 1px solid #4c4c4c;
}

.sidebar: hover .links hr{


border-color: transparent;
}

.links li{
display: flex;
align-items: center;
margin-bottom: 10px;
}

.links li i{
padding: 0px 0px;
font-size: 28px;
margin-bottom: 0px;
margin-right: 10px;
}

.links li a{
padding: 10px;
color: #000;
display: none;
font-weight: 500;
white-space: nowrap;
text-decoration: none;
display: block;
}

.sidebar:hover .links li a{
display: block;
}

.links .logout-link{
margin-top: 20px
}

.links .logout-link{
background-color: navajowhite;
}

.Welcome{
margin-top: 20px;
text-align: center;
}
.Welcome{
color: white;
}

.container {
margin-top: 60px;
background: rgba(255, 255, 255, 0.9);
padding: 20px;
border-radius: 10px;
}

h2 {
margin-bottom: 20px;
color: #222;
}

table {
width: 100%;
margin-bottom: 20px;
border-collapse: collapse;
}

th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}

th {
background-color: #f2f2f2;
color: #333;
}

tr:hover {
background-color: #f5f5f5;
}

a.btn-add, a.btn-action {
display: inline-block;
padding: 10px 20px;
margin-bottom: 20px;
font-size: 16px;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 5px;
text-decoration: none;
}

a.btn-add:hover, a.btn-action:hover {
background-color: #0056b3;
}

a.btn-action {
padding: 5px 10px;
}
</style>
<body>

<aside class="sidebar">
<div class="logo">
<img src="./img/download.jpg" alt="logo">
<!-- <h2>Church Management</h2> -->
</div>
<ul class="links">
<!-- <h4>DASHBOARD</h4> -->
<li>
<i class="ri-home-4-line"></i>
<a href="index2.php">Home</a>
</li>
<li>
<i class="ri-mail-open-line"></i>
<a href="readsong.php">Songs</a>
</li>
<li>
<i class="ri-account-circle-line"></i>
<a href="readplayer.php">Players</a>
</li>
<li>
<i class="ri-file-chart-line"></i>
<a href="readlineup.php">Line-Ups</a>
</li>
<!-- <li>
<i class="ri-book-read-line"></i>
<a href="#">History</a>
</li> -->
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<li>
<i class="ri-account-circle-line"></i>
<a href="logout.php">Log-out</a>
</li>
</ul>
</aside>

<!-- <div class="Welcome">


<h1>Welcome to Praise and Worship Management!<br><?php echo $_SESSION['username']; ?></h1>
</div> -->
<br>
<div class="container">
<h2>Players List</h2>
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th>ID</th>
<th>Name</th>
<th>Role</th>
<th>Phone Number</th>
<th>Email</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
include 'php_con.php';

$sql = "SELECT * FROM players";


$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<tr>
<td>" . $row["id"]. "</td>
<td>" . $row["name"]. "</td>
<td>" . $row["role"]. "</td>
<td>" . $row["phone_number"]. "</td>
<td>" . $row["email"]. "</td>
<td>
<a href='update.php?id=".$row["id"]."' class='btn btn-primary btn-sm'>Edit</a>
<a href='delete.php?id=".$row["id"]."' class='btn btn-danger btn-sm'>Delete</a>
</td>
</tr>";
}
} else {
echo "<tr><td colspan='5'>No records found</td></tr>";
}
$conn->close();
?>
</tbody>
</table>
<a href="addplayer.php" class="btn-add">Add New Player</a>
</div>
</body>
</html>
Addplayer.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="sidebar.css">
<title>Create Player</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}

body{
height: 100v;
width: 100%;
background: whitesmoke;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
/* background-image: url('img/Alogo.jpg');
background-size: cover;
background-position: center; */
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url(img/Alogo.jpg);
background-repeat: no-repeat;
background-position: center;
}

.sidebar{
position: fixed;
left: 0;
top: 0;
height: 100%;
width: 225px;
background: white;
display: flex;
align-items: center;
flex-direction: column;
border-right: 1px solid rgba(255, 255, 255, 0.7);
/* transition: width 0.32 ease; */
}

/* .sidebar:hover{
width: 260px;
} */

.links h4{
color: #222;
font-weight: 500;
display: none;
margin-bottom: 10px;
}
.sidebar:hover .links h4{
display: block;
}

.links hr{
margin: 10px 8px;
border: 1px solid #4c4c4c;
}

.sidebar: hover .links hr{


border-color: transparent;
}

.links li{
display: flex;
align-items: center;
margin-bottom: 10px;
}

.links li i{
padding: 0px 0px;
font-size: 28px;
margin-bottom: 0px;
margin-right: 10px;
}

.links li a{
padding: 10px;
color: #000;
display: none;
font-weight: 500;
white-space: nowrap;
text-decoration: none;
display: block;
}

.sidebar:hover .links li a{
display: block;
}

.links .logout-link{
margin-top: 20px
}

.links .logout-link{
background-color: navajowhite;
}

.Welcome{
margin-top: 20px;
text-align: center;
}
.Welcome{
color: white;
}

.container {
margin-top: 60px;
background: rgba(255, 255, 255, 0.9);
padding: 20px;
border-radius: 10px;
max-width: 500px;
width: 100%;
}
h2 {
margin-bottom: 20px;
color: #222;
text-align: center;
}

label {
margin-top: 10px;
}

select[id="role"],
input[type="text"],
input[type="email"] {
width: 100%;
padding: 10px;
margin: 5px 0 20px;
border: 1px solid #ddd;
border-radius: 5px;
}

input[type="submit"] {
display: inline-block;
width: 100%;
padding: 10px 20px;
font-size: 16px;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 5px;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #0056b3;
}

</style>
</head>
<body>
<aside class="sidebar">
<div class="logo">
<img src="./img/download.jpg" alt="logo">
<!-- <h2>Church Management</h2> -->
</div>
<ul class="links">
<!-- <h4>DASHBOARD</h4> -->
<li>
<i class="ri-home-4-line"></i>
<a href="index2.php">Home</a>
</li>
<li>
<i class="ri-mail-open-line"></i>
<a href="readsong.php">Songs</a>
</li>
<li>
<i class="ri-account-circle-line"></i>
<a href="readplayer.php">Players</a>
</li>
<li>
<i class="ri-file-chart-line"></i>
<a href="readlineup.php">Line-Ups</a>
</li>
<!-- <li>
<i class="ri-book-read-line"></i>
<a href="#">History</a>
</li> -->
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<li>
<i class="ri-account-circle-line"></i>
<a href="logout.php">Log-out</a>
</li>
</ul>
</aside>
<div class="container">
<h2>Create Player</h2>
<form method="post" action="insertplayer.php">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>

<label for="role">Role:</label>
<!-- <input type="text" id="role" name="role" required> -->
<select name="role" id="role">
<option value=" "> </option>
<option value="Drummer">Drummer</option>
<option value="Acoustic Guitar">Acoustic Guitar</option>
<option value="Bass Guitar">Bass Guitar</option>
<option value="Keyboard">Keyboard</option>
<option value="Electric Guitar">Electric Guitar</option>
<option value="Cahon">Cahon</option>
<option value="Kalimba">Kalimba</option>
<option value="Singer">Singer</option>
</select>
<br>
<label for="phone_number">Phone Number:</label>
<input type="text" id="phone_number" name="phone_number" required>

<label for="email">Email:</label>
<input type="email" id="email" name="email" required>

<input type="submit" value="Submit">


</form>
<br>
<a class="btn-back" href="readplayer.php">Back to Player List</a>
</div>
</body>
</html>
Update.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="sidebar.css">
<title>Update Player</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}

body{
height: 100v;
width: 100%;
background: whitesmoke;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
/* background-image: url('img/Alogo.jpg');
background-size: cover;
background-position: center; */
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url(img/Alogo.jpg);
background-repeat: no-repeat;
background-position: center;
}

.sidebar{
position: fixed;
left: 0;
top: 0;
height: 100%;
width: 225px;
background: white;
display: flex;
align-items: center;
flex-direction: column;
border-right: 1px solid rgba(255, 255, 255, 0.7);
/* transition: width 0.32 ease; */
}

/* .sidebar:hover{
width: 260px;
} */

.links h4{
color: #222;
font-weight: 500;
display: none;
margin-bottom: 10px;
}
.sidebar:hover .links h4{
display: block;
}

.links hr{
margin: 10px 8px;
border: 1px solid #4c4c4c;
}

.sidebar: hover .links hr{


border-color: transparent;
}

.links li{
display: flex;
align-items: center;
margin-bottom: 10px;
}

.links li i{
padding: 0px 0px;
font-size: 28px;
margin-bottom: 0px;
margin-right: 10px;
}

.links li a{
padding: 10px;
color: #000;
display: none;
font-weight: 500;
white-space: nowrap;
text-decoration: none;
display: block;
}

.sidebar:hover .links li a{
display: block;
}

.links .logout-link{
margin-top: 20px
}

.links .logout-link{
background-color: navajowhite;
}

.Welcome{
margin-top: 20px;
text-align: center;
}
.Welcome{
color: white;
}

.container {
margin-top: 60px;
background: rgba(255, 255, 255, 0.9);
padding: 20px;
border-radius: 10px;
max-width: 500px;
width: 100%;
}
h2 {
margin-bottom: 20px;
color: #222;
text-align: center;
}

label {
margin-top: 10px;
}

input[type="text"],
select[id="role"],
input[type="email"] {
width: 100%;
padding: 10px;
margin: 5px 0 20px;
border: 1px solid #ddd;
border-radius: 5px;
}

input[type="submit"] {
display: inline-block;
width: 100%;
padding: 10px 20px;
font-size: 16px;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 5px;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #0056b3;
}

</style>
</head>
<body>
<aside class="sidebar">
<div class="logo">
<img src="./img/download.jpg" alt="logo">
</div>
<ul class="links">
<li>
<i class="ri-home-4-line"></i>
<a href="#">Home</a>
</li>
<li>
<i class="ri-mail-open-line"></i>
<a href="readsong.php">Songs</a>
</li>
<li>
<i class="ri-account-circle-line"></i>
<a href="readplayer.php">Player</a>
</li>
<li>
<i class="ri-file-chart-line"></i>
<a href="readlineup.php">Line-Ups</a>
</li>
<!-- <li>
<i class="ri-book-read-line"></i>
<a href="#">History</a>
</li> -->
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<li>
<i class="ri-account-circle-line"></i>
<a href="logout.php">Log-out</a>
</li>
</ul>
</aside>
<div class="container">
<?php
include 'php_con.php';
$id = $_GET['id'];

$sql = "SELECT * FROM players WHERE id=$id";


$result = $conn->query($sql);

if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
?>
<h2>Update Player</h2>
<form method="post" action="edit.php">
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
<label for="name">Name:</label>
<input type="text" id="name" name="name" value="<?php echo $row['name']; ?>" required>

<!-- <label for="role">Role:</label>


<input type="text" id="role" name="role" value="<?php echo $row['role']; ?>" required> -->
<label for="role">Role:</label>
<!-- <input type="text" id="role" name="role" required> -->
<select name="role" id="role" value="<?php echo $row['role']; ?>" required>
<option value="Drummer">Drummer</option>
<option value="Acoustic Guitar">Acoustic Guitar</option>
<option value="Bass Guitar">Bass Guitar</option>
<option value="Keyboard">Keyboard</option>
<option value="Electric Guitar">Electric Guitar</option>
<option value="Cahon">Cahon</option>
<option value="Kalimba">Kalimba</option>
<option value="Singer">Singer</option>
</select>
<br>

<label for="phone_number">Phone Number:</label>


<input type="text" id="phone_number" name="phone_number" value="<?php echo $row['phone_number']; ?>" required>

<label for="email">Email:</label>
<input type="email" id="email" name="email" value="<?php echo $row['email']; ?>" required>

<input type="submit" value="Update">


<a class="btn-back" href="readplayer.php">Back to Player List</a>
</form>
<?php
} else {
echo "<p>No record found</p>";
}
$conn->close();
?>
</div>
</body>
</html>
Insert.php
<?php
include 'php_con.php';

if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'];
$role = $_POST['role'];
$phone_number = $_POST['phone_number'];
$email = $_POST['email'];

$sql = "INSERT INTO players (name, role, phone_number, email) VALUES ('$name', '$role', '$phone_number', '$email')";

if ($conn->query($sql) === TRUE) {


header("Location: readplayer.php");
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
?>
<br>
<a href="readplayer.php">Back to Players List</a>
Delete.php
<?php
include 'php_con.php';

$id = $_GET['id'];

// Delete the player


$sql = "DELETE FROM players WHERE id=$id";
if ($conn->query($sql) === TRUE) {
echo "Record deleted successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$sql_reset_ai = "ALTER TABLE players AUTO_INCREMENT = 1";


if ($conn->query($sql_reset_ai) === TRUE) {
echo "Auto-increment value reset successfully";
} else {
echo "Error resetting auto-increment value: " . $sql_reset_ai . "<br>" . $conn->error;
}
$sql_reorder = "SET @count = 0;
UPDATE players SET id = @count:= @count + 1;
ALTER TABLE players AUTO_INCREMENT = 1";
if ($conn->multi_query($sql_reorder) === TRUE) {
echo "IDs reordered successfully";
} else {
echo "Error reordering IDs: " . $sql_reorder . "<br>" . $conn->error;
}

$conn->close();
?>
<br>
<a href="readplayer.php">Back to Players List</a>
Readlineup.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="sidebar.css">
<title>Lineup List</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}

body{
height: 100v;
width: 100%;
background: whitesmoke;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
/* background-image: url('img/Alogo.jpg');
background-size: cover;
background-position: center; */
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url(img/Alogo.jpg);
background-repeat: no-repeat;
background-position: center;
}

.sidebar{
position: fixed;
left: 0;
top: 0;
height: 100%;
width: 225px;
background: white;
display: flex;
align-items: center;
flex-direction: column;
border-right: 1px solid rgba(255, 255, 255, 0.7);
/* transition: width 0.32 ease; */
}

/* .sidebar:hover{
width: 260px;
} */

.links h4{
color: #222;
font-weight: 500;
display: none;
margin-bottom: 10px;
}
.sidebar:hover .links h4{
display: block;
}

.links hr{
margin: 10px 8px;
border: 1px solid #4c4c4c;
}

.sidebar: hover .links hr{


border-color: transparent;
}

.links li{
display: flex;
align-items: center;
margin-bottom: 10px;
}

.links li i{
padding: 0px 0px;
font-size: 28px;
margin-bottom: 0px;
margin-right: 10px;
}

.links li a{
padding: 10px;
color: #000;
display: none;
font-weight: 500;
white-space: nowrap;
text-decoration: none;
display: block;
}

.sidebar:hover .links li a{
display: block;
}

.links .logout-link{
margin-top: 20px
}

.links .logout-link{
background-color: navajowhite;
}

.Welcome{
margin-top: 20px;
text-align: center;
}
.Welcome{
color: white;
}

.container {
margin-top: 60px;
background: rgba(255, 255, 255, 0.9);
padding: 20px;
border-radius: 10px;
max-width: 100%;
width: auto;
overflow-x: auto;
margin-center: 0 auto;
}

h2 {
margin-bottom: 20px;
color: #222;
text-align: center;
}

table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
font-size: 13px;
margin: 0 auto;

th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}

th {
background-color: #f2f2f2;
color: #333;
}

tr:hover {
background-color: #f5f5f5;
}

a.btn-add, a.btn-action {
display: inline-block;
padding: 10px 20px;
margin-bottom: 20px;
font-size: 16px;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 5px;
text-decoration: none;
}

a.btn-add:hover, a.btn-action:hover {
background-color: #0056b3;
}

a.btn-action {
padding: 5px 10px;
}
</style>
</head>
<body>
<aside class="sidebar">
<div class="logo">
<img src="./img/download.jpg" alt="logo">
</div>
<ul class="links">
<li>
<i class="ri-home-4-line"></i>
<a href="index2.php">Home</a>
</li>
<li>
<i class="ri-mail-open-line"></i>
<a href="readsong.php">Songs</a>
</li>
<li>
<i class="ri-account-circle-line"></i>
<a href="readplayer.php">Players</a>
</li>
<li>
<i class="ri-file-chart-line"></i>
<a href="readlineup.php">Line-Ups</a>
</li>
<!-- <li>
<i class="ri-book-read-line"></i>
<a href="#">History</a>
</li> -->
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<li>
<i class="ri-account-circle-line"></i>
<a href="login.php">Log-out</a>
</li>
</ul>
</aside>
<div class="container">
<h2>Lineup List</h2>
<a href="addlineup.php" class="btn-add">Add New Lineup</a><br><br>
<table border="1">
<tr>
<th>Date</th>
<th>Chords</th>
<th>Lyrics</th>
<th>Additional Info</th>
<th>Action</th>
</tr>
<?php
include 'php_con.php';

$sql = "SELECT * FROM line_up";


$result = $conn->query($sql);

if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr>
<td>" . $row["date"] . "</td>
<td>" . $row["chords"] . "</td>
<td>";

// Check if lyrics link ends with .pdf or .docx


$is_pdf = strpos($row["lyrics"], '.pdf') !== false;
$is_docx = strpos($row["lyrics"], '.docx') !== false;

if ($is_pdf || $is_docx) {
echo "<a href='" . $row["lyrics"] . "' target='_blank' download>Download</a>";
} else {
echo "<a href='" . $row["lyrics"] . "' target='_blank'>" . $row["lyrics"] . "</a>";
}

echo "</td>
<td>" . $row["add_newlineup"] . "</td>
<td>
<a href='updatelineup.php?id=" . $row["id"] . "' class='btn-action'>Edit</a> |
<a href='deletelineup.php?id=" . $row["id"] . "' class='btn-action'>Delete</a>
</td>
</tr>";
}
} else {
echo "<tr><td colspan='5'>No records found</td></tr>";
}
$conn->close();
?>
</table>
</div>
</body>
</html>
Addlineup.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="sidebar.css">
<title>Create Lineup</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}

body{
height: 100v;
width: 100%;
background: whitesmoke;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
/* background-image: url('img/Alogo.jpg');
background-size: cover;
background-position: center; */
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url(img/Alogo.jpg);
background-repeat: no-repeat;
background-position: center;
}

.sidebar{
position: fixed;
left: 0;
top: 0;
height: 100%;
width: 225px;
background: white;
display: flex;
align-items: center;
flex-direction: column;
border-right: 1px solid rgba(255, 255, 255, 0.7);
/* transition: width 0.32 ease; */
}

/* .sidebar:hover{
width: 260px;
} */

.links h4{
color: #222;
font-weight: 500;
display: none;
margin-bottom: 10px;
}
.sidebar:hover .links h4{
display: block;
}

.links hr{
margin: 10px 8px;
border: 1px solid #4c4c4c;
}

.sidebar: hover .links hr{


border-color: transparent;
}

.links li{
display: flex;
align-items: center;
margin-bottom: 10px;
}

.links li i{
padding: 0px 0px;
font-size: 28px;
margin-bottom: 0px;
margin-right: 10px;
}

.links li a{
padding: 10px;
color: #000;
display: none;
font-weight: 500;
white-space: nowrap;
text-decoration: none;
display: block;
}

.sidebar:hover .links li a{
display: block;
}

.links .logout-link{
margin-top: 20px
}

.links .logout-link{
background-color: navajowhite;
}

.Welcome{
margin-top: 20px;
text-align: center;
}
.Welcome{
color: white;
}

.container {
margin-top: 60px;
background: rgba(255, 255, 255, 0.9);
padding: 20px;
border-radius: 10px;
max-width: 500px;
width: 100%;
}
h2 {
margin-bottom: 20px;
color: #222;
text-align: center;
}

label {
margin-top: 10px;
display: block;
}

input[type="text"],
input[type="email"],
input[type="date"],
select {
width: 100%;
padding: 10px;
margin: 5px 0 20px;
border: 1px solid #ddd;
border-radius: 5px;
}

input[type="submit"] {
display: inline-block;
width: 100%;
padding: 10px 20px;
font-size: 16px;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 5px;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #0056b3;
}

a{
text-decoration: none;
color: #007bff;
}

a:hover {
color: #0056b3;
}

</style>
</head>
<body>
<aside class="sidebar">
<div class="logo">
<img src="./img/download.jpg" alt="logo">
</div>
<ul class="links">
<li>
<i class="ri-home-4-line"></i>
<a href="index2.php">Home</a>
</li>
<li>
<i class="ri-mail-open-line"></i>
<a href="readsong.php">Songs</a>
</li>
<li>
<i class="ri-account-circle-line"></i>
<a href="readplayer.php">Players</a>
</li>
<li>
<i class="ri-file-chart-line"></i>
<a href="readlineup.php">Line-Ups</a>
</li>
<!-- <li>
<i class="ri-book-read-line"></i>
<a href="#">History</a>
</li> -->
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<li>
<i class="ri-account-circle-line"></i>
<a href="login.php">Log-out</a>
</li>
</ul>
</aside>
<div class="container">
<h2>Create Lineup</h2>
<form method="post" action="insertlineup.php">
<label for="player_id">Player:</label>
<select id="player_id" name="player_id">
<?php
include 'php_con.php';
$sql = "SELECT id, name FROM players";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
echo "<option value='".$row['id']."'>".$row['name']."</option>";
}
?>
</select>
<label for="song_id">Song:</label>
<select id="song_id" name="song_id">
<?php
$sql = "SELECT id, title FROM songs";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
echo "<option value='".$row['id']."'>".$row['title']."</option>";
}
?>
</select>
<label for="date">Date:</label>
<input type="date" id="date" name="date">
<label for="chords">Chords:</label>
<input type="text" id="chords" name="chords">
<label for="lyrics">Lyrics:</label>
<input type="text" id="lyrics" name="lyrics">
<label for="add_newlineup">Additional Info:</label>
<input type="text" id="add_newlineup" name="add_newlineup">
<input type="submit" value="Submit">
</form>
<br>
<a href="readlineup.php">Back to Lineup List</a>
</div>
</body>
</html>
Updatelineup.php
<?php
include 'php_con.php';

$id = $_POST['id'];
$player_id = $_POST['player_id'];
$song_id = $_POST['song_id'];
$date = $_POST['date'];
$chords = $_POST['chords'];
$lyrics = $_POST['lyrics'];
$add_newlineup = $_POST['add_newlineup'];

$sql = "UPDATE line_up


SET player_id='$player_id', song_id='$song_id', date='$date', chords='$chords', lyrics='$lyrics', add_newlineup='$add_newlineup'
WHERE id=$id";

if ($conn->query($sql) === TRUE) {


echo "Record updated successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>
<br>
<a href="readlineup.php">Back to Lineup List</a>
Insertlineup.php
<?php
include 'php_con.php';

$player_id = $_POST['player_id'];
$song_id = $_POST['song_id'];
$date = $_POST['date'];
$chords = $_POST['chords'];
$lyrics = $_POST['lyrics'];
$add_newlineup = $_POST['add_newlineup'];

if(!preg_match('/\.pdf$|\.docx$/',$lyrics)){
$lyrics .= '.pdf';
}

$sql = "INSERT INTO line_up (player_id, song_id, date, chords, lyrics, add_newlineup)
VALUES ('$player_id', '$song_id', '$date', '$chords', '$lyrics', '$add_newlineup')";

if ($conn->query($sql) === TRUE) {


echo "New lineup created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>
<br>
<a href="readlineup.php">Back to Lineup List</a>

Deletelineup.php
<?php
include 'php_con.php';

$id = $_GET['id'];

$sql = "DELETE FROM line_up WHERE id=$id";

if ($conn->query($sql) === TRUE) {


echo "Record deleted successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}

$conn->close();
?>
<br>
<a href="readlineup.php">Back to Lineup List</a>

Logout.php
<?php
session_start();
session_destroy();
header("Location: login.php");
?>
My Database/church_management3.sql
/*
Navicat Premium Data Transfer

Source Server : try


Source Server Type : MySQL
Source Server Version : 100113
Source Host : localhost:3306
Source Schema : church_management3

Target Server Type : MySQL


Target Server Version : 100113
File Encoding : 65001

Date: 01/07/2024 13:23:59


*/

SET NAMES utf8mb4;


SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for admin
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`midname` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`lname` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`username` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`password` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Records of admin
-- ----------------------------
INSERT INTO `admin` VALUES (1, 'kuton', 'kuton', 'Kuton', 'kuton');
INSERT INTO `admin` VALUES (2, 'aica', 'aica', 'Aica', 'aica');
INSERT INTO `admin` VALUES (3, 'j', 'j', 'J', 'j');
INSERT INTO `admin` VALUES (5, 'Nanea', 'Cadiente', 'Jamieca', 'jamieca');
INSERT INTO `admin` VALUES (6, 'zeb', 'zeb', 'Zeb', '123');
INSERT INTO `admin` VALUES (9, 'Balancio', 'Estabillo', 'Anthony', 'anthony');
INSERT INTO `admin` VALUES (10, 'Balancio', 'Estabillo', 'Anthony', 'anthony');
INSERT INTO `admin` VALUES (11, 'Balancio', 'Estabillo', 'Anthony', 'anthony');

-- ----------------------------
-- Table structure for event_type
-- ----------------------------
DROP TABLE IF EXISTS `event_type`;
CREATE TABLE `event_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`code` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`description` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for history
-- ----------------------------
DROP TABLE IF EXISTS `history`;
CREATE TABLE `history` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`lineup_id` int(11) NULL DEFAULT NULL,
`event_type_id` int(11) NULL DEFAULT NULL,
`time_start` time(0) NULL DEFAULT NULL,
`time_end` time(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `history_event_type`(`event_type_id`) USING BTREE,
INDEX `history_lineup`(`lineup_id`) USING BTREE,
CONSTRAINT `history_event_type` FOREIGN KEY (`event_type_id`) REFERENCES `event_type` (`id`) ON DELETE RESTRICT ON
UPDATE CASCADE,
CONSTRAINT `history_lineup` FOREIGN KEY (`lineup_id`) REFERENCES `line_up` (`id`) ON DELETE RESTRICT ON UPDATE
CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Table structure for line_up
-- ----------------------------
DROP TABLE IF EXISTS `line_up`;
CREATE TABLE `line_up` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`player_id` int(11) NULL DEFAULT NULL,
`song_id` int(11) NULL DEFAULT NULL,
`date` date NULL DEFAULT NULL,
`chords` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`lyrics` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`add_newlineup` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `lineup_player`(`player_id`) USING BTREE,
INDEX `lineup_song`(`song_id`) USING BTREE,
CONSTRAINT `lineup_player` FOREIGN KEY (`player_id`) REFERENCES `players` (`id`) ON DELETE RESTRICT ON UPDATE
CASCADE,
CONSTRAINT `lineup_song` FOREIGN KEY (`song_id`) REFERENCES `songs` (`id`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Records of line_up
-- ----------------------------
INSERT INTO `line_up` VALUES (1, 1, 1, '2024-06-23', 'G-D-Am-F', '', 'Practice natin');
INSERT INTO `line_up` VALUES (2, 4, 4, '2024-06-29', 'C-G-Am-F', 'lineups', 'Pang Sabado');
INSERT INTO `line_up` VALUES (5, 3, 1, '2024-07-14', 'G-D-E-F', 'lineups', 'lineup1');

-- ----------------------------
-- Table structure for players
-- ----------------------------
DROP TABLE IF EXISTS `players`;
CREATE TABLE `players` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`phone_number` bigint(20) NULL DEFAULT NULL,
`email` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`role` varchar(50) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Records of players
-- ----------------------------
INSERT INTO `players` VALUES (1, 'Kuton', 1234, '[email protected]', 'Kalimba');
INSERT INTO `players` VALUES (2, 'Kapung', 1234, '[email protected]', 'Drummer');
INSERT INTO `players` VALUES (3, 'Anthony', 12345, '[email protected]', 'Acoustic Guitar');
INSERT INTO `players` VALUES (4, 'Jamieca', 123456, '[email protected]', 'Cahon');
INSERT INTO `players` VALUES (5, 'Aica', 1234567, '[email protected]', 'Bass Guitar');
INSERT INTO `players` VALUES (6, 'Klyne', 12345678, '[email protected]', 'Kalimba');

-- ----------------------------
-- Table structure for songs
-- ----------------------------
DROP TABLE IF EXISTS `songs`;
CREATE TABLE `songs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`artist` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
`lyrics` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Compact;

-- ----------------------------
-- Records of songs
-- ----------------------------
INSERT INTO `songs` VALUES (1, 'Our God', 'Don Moen', '');
INSERT INTO `songs` VALUES (3, '10,000 Reasons', 'Jamieca', '');
INSERT INTO `songs` VALUES (4, 'How Great is our God', 'Chris Evans', '');
INSERT INTO `songs` VALUES (11, 'Amazing Grace', 'Kuton', 'lineups.pdf');

SET FOREIGN_KEY_CHECKS = 1;

You might also like