Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
264ea8c91c | ||
|
|
5f94a53703 |
82
add_song.php
Normal file
82
add_song.php
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$response = [
|
||||||
|
'status' => 'error',
|
||||||
|
'message' => 'Invalid request.'
|
||||||
|
];
|
||||||
|
|
||||||
|
// Get the posted data
|
||||||
|
$data = json_decode(file_get_contents('php://input'), true);
|
||||||
|
|
||||||
|
if (!$data) {
|
||||||
|
echo json_encode($response);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Basic validation
|
||||||
|
$session_code = $data['sessionCode'] ?? null;
|
||||||
|
$track_title = $data['title'] ?? null;
|
||||||
|
$artist_name = $data['artist'] ?? null;
|
||||||
|
$album_art_url = $data['albumArt'] ?? null;
|
||||||
|
$source = $data['source'] ?? null;
|
||||||
|
|
||||||
|
if (!$session_code || !$track_title || !$artist_name) {
|
||||||
|
$response['message'] = 'Missing required song data.';
|
||||||
|
echo json_encode($response);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// 1. Get session ID from session code
|
||||||
|
$stmt = $pdo->prepare("SELECT id FROM sessions WHERE session_code = ? AND status = 'active'");
|
||||||
|
$stmt->execute([$session_code]);
|
||||||
|
$session = $stmt->fetch();
|
||||||
|
|
||||||
|
if (!$session) {
|
||||||
|
$response['message'] = 'Invalid or inactive session.';
|
||||||
|
echo json_encode($response);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$session_id = $session['id'];
|
||||||
|
|
||||||
|
// 2. Check for duplicates
|
||||||
|
$stmt = $pdo->prepare("SELECT id FROM queue_items WHERE session_id = ? AND track_title = ? AND artist_name = ?");
|
||||||
|
$stmt->execute([$session_id, $track_title, $artist_name]);
|
||||||
|
if ($stmt->fetch()) {
|
||||||
|
$response['message'] = 'This song is already in the queue.';
|
||||||
|
echo json_encode($response);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Insert the new song
|
||||||
|
$sql = "INSERT INTO queue_items (session_id, track_title, artist_name, album_art_url, source, added_by) VALUES (?, ?, ?, ?, ?, ?)";
|
||||||
|
$stmt = $pdo->prepare($sql);
|
||||||
|
|
||||||
|
// For now, added_by is anonymous. This can be updated later with user profiles.
|
||||||
|
$added_by = 'Guest';
|
||||||
|
|
||||||
|
if ($stmt->execute([$session_id, $track_title, $artist_name, $album_art_url, $source, $added_by])) {
|
||||||
|
$new_song_id = $pdo->lastInsertId();
|
||||||
|
|
||||||
|
// Fetch the newly added song to return to the client
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM queue_items WHERE id = ?");
|
||||||
|
$stmt->execute([$new_song_id]);
|
||||||
|
$new_song_data = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$response['status'] = 'success';
|
||||||
|
$response['message'] = 'Song added successfully!';
|
||||||
|
$response['data'] = $new_song_data;
|
||||||
|
} else {
|
||||||
|
$response['message'] = 'Failed to add song to the database.';
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// In a real app, log this error instead of exposing it.
|
||||||
|
$response['message'] = 'Database error: ' . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode($response);
|
||||||
354
assets/css/custom.css
Normal file
354
assets/css/custom.css
Normal file
@ -0,0 +1,354 @@
|
|||||||
|
|
||||||
|
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap');
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--background-color: #121212;
|
||||||
|
--surface-color: #1E1E1E;
|
||||||
|
--primary-color: #1DB954;
|
||||||
|
--text-primary-color: #FFFFFF;
|
||||||
|
--text-secondary-color: #B3B3B3;
|
||||||
|
--border-radius-btn: 12px;
|
||||||
|
--border-radius-card: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: var(--background-color);
|
||||||
|
color: var(--text-primary-color);
|
||||||
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||||
|
scroll-behavior: smooth;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar {
|
||||||
|
background-color: rgba(30, 30, 30, 0.8);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
font-weight: 900;
|
||||||
|
font-size: 1.75rem;
|
||||||
|
color: var(--text-primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand:hover {
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
background: linear-gradient(180deg, var(--surface-color) 0%, var(--background-color) 100%);
|
||||||
|
padding: 120px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero h1 {
|
||||||
|
font-weight: 900;
|
||||||
|
font-size: 3.5rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero p {
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
font-size: 1.25rem;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
border-color: var(--primary-color);
|
||||||
|
border-radius: var(--border-radius-btn);
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 12px 32px;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
transition: background-color 0.3s ease, transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #1ed760;
|
||||||
|
border-color: #1ed760;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
padding: 80px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 2.5rem;
|
||||||
|
margin-bottom: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-card {
|
||||||
|
background-color: var(--surface-color);
|
||||||
|
border-radius: var(--border-radius-card);
|
||||||
|
padding: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
height: 100%;
|
||||||
|
border: 1px solid #282828;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-card .icon {
|
||||||
|
font-size: 3rem;
|
||||||
|
color: var(--primary-color);
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-card h3 {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-card p {
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
background-color: var(--surface-color);
|
||||||
|
padding: 2rem 0;
|
||||||
|
text-align: center;
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a {
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer a:hover {
|
||||||
|
color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Floating Action Button (FAB) */
|
||||||
|
.fab {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 30px;
|
||||||
|
right: 30px;
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--text-primary-color);
|
||||||
|
font-size: 24px;
|
||||||
|
border: none;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.2s ease-in-out, background-color 0.2s;
|
||||||
|
z-index: 1050;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fab:hover {
|
||||||
|
background-color: #1ed760;
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal Styles */
|
||||||
|
.modal-overlay {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
backdrop-filter: blur(5px);
|
||||||
|
z-index: 1055;
|
||||||
|
display: none; /* Hidden by default */
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-overlay.visible {
|
||||||
|
display: block;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-container {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
background-color: var(--surface-color);
|
||||||
|
border-top-left-radius: 20px;
|
||||||
|
border-top-right-radius: 20px;
|
||||||
|
padding: 1.5rem;
|
||||||
|
transform: translateY(100%);
|
||||||
|
transition: transform 0.3s ease-out;
|
||||||
|
max-height: 80vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-overlay.visible .modal-container {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
border-bottom: 1px solid #282828;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-title {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-close-modal {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-close-modal:hover {
|
||||||
|
color: var(--text-primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-bar-container {
|
||||||
|
position: relative;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-bar-container .bi-search {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 15px;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
#song-search-input {
|
||||||
|
background-color: #282828;
|
||||||
|
border: 1px solid #333;
|
||||||
|
color: var(--text-primary-color);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding-left: 40px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#song-search-input::placeholder {
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-toggles {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-source {
|
||||||
|
flex-grow: 1;
|
||||||
|
background-color: #282828;
|
||||||
|
border: 1px solid #333;
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 10px;
|
||||||
|
transition: background-color 0.2s, color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-source.active {
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
color: var(--text-primary-color);
|
||||||
|
border-color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-result-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-result-item:hover {
|
||||||
|
background-color: #282828;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-result-item img {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-result-item .track-info {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-result-item .track-title {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-result-item .artist-name {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-icon {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.queue-item {
|
||||||
|
background-color: var(--surface-color);
|
||||||
|
border-radius: var(--border-radius-card);
|
||||||
|
padding: 1rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border: 1px solid #282828;
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
transition: opacity 0.5s ease, transform 0.5s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.queue-item.new-item {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(20px);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.queue-item img {
|
||||||
|
width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-right: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.queue-item .track-info {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.queue-item .track-title {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.queue-item .artist-name {
|
||||||
|
color: var(--text-secondary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.vote-button {
|
||||||
|
background-color: transparent;
|
||||||
|
border: 1px solid var(--primary-color);
|
||||||
|
color: var(--primary-color);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vote-button .bi {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
112
assets/js/main.js
Normal file
112
assets/js/main.js
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
// Smooth scroll for anchor links
|
||||||
|
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||||
|
anchor.addEventListener('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
document.querySelector(this.getAttribute('href')).scrollIntoView({
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// --- Add Song Modal Logic ---
|
||||||
|
const addSongFab = document.getElementById('add-song-fab');
|
||||||
|
const modalOverlay = document.getElementById('add-song-modal-overlay');
|
||||||
|
const modalContainer = document.getElementById('add-song-modal-container');
|
||||||
|
const closeModalBtn = document.getElementById('close-modal-btn');
|
||||||
|
const searchResultsContainer = document.getElementById('search-results');
|
||||||
|
const queueList = document.getElementById('queue-list');
|
||||||
|
const emptyQueueMessage = document.getElementById('empty-queue-message');
|
||||||
|
|
||||||
|
if (addSongFab) {
|
||||||
|
addSongFab.addEventListener('click', () => {
|
||||||
|
modalOverlay.classList.add('visible');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (closeModalBtn) {
|
||||||
|
closeModalBtn.addEventListener('click', closeModal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modalOverlay) {
|
||||||
|
modalOverlay.addEventListener('click', (e) => {
|
||||||
|
if (e.target === modalOverlay) {
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
modalContainer.style.transform = 'translateY(100%)';
|
||||||
|
modalOverlay.classList.remove('visible');
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Add Song to Queue Logic ---
|
||||||
|
searchResultsContainer.addEventListener('click', (e) => {
|
||||||
|
const resultItem = e.target.closest('.search-result-item');
|
||||||
|
if (!resultItem) return;
|
||||||
|
|
||||||
|
const song = {
|
||||||
|
title: resultItem.dataset.title,
|
||||||
|
artist: resultItem.dataset.artist,
|
||||||
|
albumArt: resultItem.dataset.albumArt,
|
||||||
|
source: resultItem.dataset.source,
|
||||||
|
sessionCode: window.currentSessionCode
|
||||||
|
};
|
||||||
|
|
||||||
|
addSongToQueue(song);
|
||||||
|
});
|
||||||
|
|
||||||
|
async function addSongToQueue(song) {
|
||||||
|
try {
|
||||||
|
const response = await fetch('add_song.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify(song),
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await response.json();
|
||||||
|
|
||||||
|
if (result.status === 'success') {
|
||||||
|
addSongToDOM(result.data);
|
||||||
|
closeModal();
|
||||||
|
} else {
|
||||||
|
alert(result.message || 'Failed to add song.');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error adding song:', error);
|
||||||
|
alert('An error occurred. Please try again.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addSongToDOM(song) {
|
||||||
|
if (emptyQueueMessage) {
|
||||||
|
emptyQueueMessage.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
const queueItem = document.createElement('div');
|
||||||
|
queueItem.className = 'queue-item new-item';
|
||||||
|
queueItem.innerHTML = `
|
||||||
|
<img src="${song.album_art_url}" alt="Album Art">
|
||||||
|
<div class="track-info">
|
||||||
|
<div class="track-title">${song.track_title}</div>
|
||||||
|
<div class="artist-name">${song.artist_name}</div>
|
||||||
|
</div>
|
||||||
|
<button class="vote-button">
|
||||||
|
<i class="bi bi-caret-up-fill"></i>
|
||||||
|
<span>${song.votes}</span>
|
||||||
|
</button>
|
||||||
|
`;
|
||||||
|
|
||||||
|
queueList.appendChild(queueItem);
|
||||||
|
|
||||||
|
// Trigger the animation
|
||||||
|
setTimeout(() => {
|
||||||
|
queueItem.classList.remove('new-item');
|
||||||
|
}, 10); // Small delay to ensure the transition is applied
|
||||||
|
}
|
||||||
|
});
|
||||||
35
create_session.php
Normal file
35
create_session.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
function generate_code($length = 6) {
|
||||||
|
$chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
$code = '';
|
||||||
|
for ($i = 0; $i < $length; $i++) {
|
||||||
|
$code .= $chars[rand(0, strlen($chars) - 1)];
|
||||||
|
}
|
||||||
|
return $code;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdo = db();
|
||||||
|
$session_code = '';
|
||||||
|
$is_unique = false;
|
||||||
|
|
||||||
|
// Generate a unique code
|
||||||
|
while (!$is_unique) {
|
||||||
|
$session_code = generate_code();
|
||||||
|
$stmt = $pdo->prepare("SELECT id FROM sessions WHERE session_code = ?");
|
||||||
|
$stmt->execute([$session_code]);
|
||||||
|
if ($stmt->rowCount() === 0) {
|
||||||
|
$is_unique = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert the new session
|
||||||
|
$stmt = $pdo->prepare("INSERT INTO sessions (session_code) VALUES (?)");
|
||||||
|
$stmt->execute([$session_code]);
|
||||||
|
|
||||||
|
$session_id = $pdo->lastInsertId();
|
||||||
|
|
||||||
|
// Redirect to the session page
|
||||||
|
header("Location: session.php?id=" . $session_id);
|
||||||
|
exit();
|
||||||
33
db/setup.php
Normal file
33
db/setup.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/config.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$pdo->exec("
|
||||||
|
CREATE TABLE IF NOT EXISTS sessions (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
session_code VARCHAR(6) NOT NULL UNIQUE,
|
||||||
|
status ENUM('active', 'ended') NOT NULL DEFAULT 'active',
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
");
|
||||||
|
|
||||||
|
$pdo->exec("
|
||||||
|
CREATE TABLE IF NOT EXISTS queue_items (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
session_id INT NOT NULL,
|
||||||
|
track_title VARCHAR(255) NOT NULL,
|
||||||
|
artist_name VARCHAR(255),
|
||||||
|
album_art_url VARCHAR(255),
|
||||||
|
added_by VARCHAR(255),
|
||||||
|
votes INT DEFAULT 0,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
FOREIGN KEY (session_id) REFERENCES sessions(id) ON DELETE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
");
|
||||||
|
|
||||||
|
echo "Database tables created successfully.\n";
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die("Database setup failed: " . $e->getMessage());
|
||||||
|
}
|
||||||
239
index.php
239
index.php
@ -1,150 +1,99 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
declare(strict_types=1);
|
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
|
||||||
<?php
|
<!-- SEO Meta Tags -->
|
||||||
// Read project preview data from environment
|
<title>SyncUp - Your Music, Your Vibe, Together.</title>
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<meta name="description" content="SyncUp is a mobile web app for creating shared music sessions. Let guests add and upvote songs from Spotify or YouTube in real-time. Perfect for parties and social gatherings.">
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<meta name="keywords" content="shared music queue, collaborative playlist, party music app, real-time playlist, music voting, spotify integration, youtube integration, social music, event music, Built with Flatlogic Generator">
|
||||||
?>
|
|
||||||
<?php if ($projectDescription): ?>
|
<!-- Open Graph / Facebook -->
|
||||||
<!-- Meta description -->
|
<meta property="og:type" content="website">
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
<meta property="og:title" content="SyncUp - Your Music, Your Vibe, Together.">
|
||||||
<!-- Open Graph meta tags -->
|
<meta property="og:description" content="Create a shared music queue that your friends can control. Add songs, upvote tracks, and keep the vibe going.">
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<meta property="og:image" content="">
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<!-- Twitter -->
|
||||||
<?php endif; ?>
|
<meta property="twitter:card" content="summary_large_image">
|
||||||
<?php if ($projectImageUrl): ?>
|
<meta property="twitter:title" content="SyncUp - Your Music, Your Vibe, Together.">
|
||||||
<!-- Open Graph image -->
|
<meta property="twitter:description" content="Create a shared music queue that your friends can control. Add songs, upvote tracks, and keep the vibe going.">
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<meta property="twitter:image" content="">
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<!-- Stylesheets -->
|
||||||
<?php endif; ?>
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<script src="https://unpkg.com/feather-icons"></script>
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
<div class="card">
|
<!-- Header -->
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<div class="container">
|
||||||
<span class="sr-only">Loading…</span>
|
<a class="navbar-brand" href="#">SyncUp</a>
|
||||||
</div>
|
</div>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
</nav>
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
<!-- Hero Section -->
|
||||||
</div>
|
<section class="hero">
|
||||||
</main>
|
<div class="container">
|
||||||
<footer>
|
<div class="row">
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<div class="col-lg-8 mx-auto">
|
||||||
</footer>
|
<h1>Your Music, Your Vibe, Together.</h1>
|
||||||
|
<p class="lead">Stop passing the aux cord. Start a SyncUp session and let everyone add their favorite tracks to a shared, real-time queue.</p>
|
||||||
|
<form action="create_session.php" method="POST" class="d-inline">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg">Create a Session</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Features Section -->
|
||||||
|
<section id="features" class="section">
|
||||||
|
<div class="container">
|
||||||
|
<h2 class="section-title">How It Works</h2>
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="feature-card">
|
||||||
|
<i data-feather="zap" class="icon"></i>
|
||||||
|
<h3>1. Start a Session</h3>
|
||||||
|
<p>Instantly create a new music session and get a unique QR code for your room.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="feature-card">
|
||||||
|
<i data-feather="users" class="icon"></i>
|
||||||
|
<h3>2. Invite Your Friends</h3>
|
||||||
|
<p>Guests join by scanning the code—no app install required. They can immediately add songs.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="feature-card">
|
||||||
|
<i data-feather="bar-chart-2" class="icon"></i>
|
||||||
|
<h3>3. Curate the Vibe</h3>
|
||||||
|
<p>As the host, you can reorder or remove tracks. Guests can upvote their favorites to push them up the list.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="container">
|
||||||
|
<p>© <?php echo date("Y"); ?> SyncUp. All Rights Reserved.</p>
|
||||||
|
<p><a href="/privacy.php">Privacy Policy</a></p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<!-- Scripts -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
<script>
|
||||||
|
feather.replace()
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
138
join.php
Normal file
138
join.php
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_GET['code'])) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$session_code = $_GET['code'];
|
||||||
|
$session_id = null;
|
||||||
|
$queue_items = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT id, status FROM sessions WHERE session_code = ?");
|
||||||
|
$stmt->execute([$session_code]);
|
||||||
|
$session = $stmt->fetch();
|
||||||
|
|
||||||
|
if (!$session || $session['status'] !== 'active') {
|
||||||
|
header("Location: index.php?error=invalid_session");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
$session_id = $session['id'];
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM queue_items WHERE session_id = ? ORDER BY votes DESC, created_at ASC");
|
||||||
|
$stmt->execute([$session_id]);
|
||||||
|
$queue_items = $stmt->fetchAll();
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// In a real app, you'd log this error, not show it to the user.
|
||||||
|
die("Database error. Please check configuration.");
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>SyncUp Queue</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.10.5/font/bootstrap-icons.min.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="index.php">SyncUp</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container mt-4 pb-5">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<h1 class="mb-0">Queue</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="queue-list">
|
||||||
|
<?php if (empty($queue_items)): ?>
|
||||||
|
<div id="empty-queue-message" class="text-center p-5 rounded" style="background-color: var(--surface-color);">
|
||||||
|
<h2>The Queue is Empty</h2>
|
||||||
|
<p class="text-secondary">Be the first to add a song and get the party started!</p>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($queue_items as $item): ?>
|
||||||
|
<div class="queue-item">
|
||||||
|
<img src="<?php echo htmlspecialchars($item['album_art_url'] ?: 'https://placehold.co/64x64/1E1E1E/FFFFFF?text=S'); ?>" alt="Album Art">
|
||||||
|
<div class="track-info">
|
||||||
|
<div class="track-title"><?php echo htmlspecialchars($item['track_title']); ?></div>
|
||||||
|
<div class="artist-name"><?php echo htmlspecialchars($item['artist_name']); ?></div>
|
||||||
|
</div>
|
||||||
|
<button class="vote-button">
|
||||||
|
<i class="bi bi-caret-up-fill"></i>
|
||||||
|
<span><?php echo $item['votes']; ?></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Floating Action Button -->
|
||||||
|
<button class="fab" id="add-song-fab" aria-label="Add song">
|
||||||
|
<i class="bi bi-plus-lg"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Add Song Modal -->
|
||||||
|
<div class="modal-overlay" id="add-song-modal-overlay">
|
||||||
|
<div class="modal-container" id="add-song-modal-container">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Add a Song</h5>
|
||||||
|
<button type="button" class="btn-close-modal" id="close-modal-btn" aria-label="Close">
|
||||||
|
<i class="bi bi-x-lg"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="search-bar-container">
|
||||||
|
<i class="bi bi-search"></i>
|
||||||
|
<input type="text" id="song-search-input" class="form-control" placeholder="Search for a song or artist...">
|
||||||
|
</div>
|
||||||
|
<div class="source-toggles">
|
||||||
|
<button class="btn btn-source active" data-source="spotify">
|
||||||
|
<i class="bi bi-spotify"></i> Spotify
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-source" data-source="youtube">
|
||||||
|
<i class="bi bi-youtube"></i> YouTube
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div id="search-results" class="mt-3">
|
||||||
|
<!-- Hardcoded placeholder results -->
|
||||||
|
<div class="search-result-item" data-title="Blinding Lights" data-artist="The Weeknd" data-album-art="https://placehold.co/64x64/1ed760/000000?text=BL" data-source="spotify">
|
||||||
|
<img src="https://placehold.co/64x64/1ed760/000000?text=BL" alt="Album Art">
|
||||||
|
<div class="track-info">
|
||||||
|
<div class="track-title">Blinding Lights</div>
|
||||||
|
<div class="artist-name">The Weeknd</div>
|
||||||
|
</div>
|
||||||
|
<i class="bi bi-spotify source-icon"></i>
|
||||||
|
</div>
|
||||||
|
<div class="search-result-item" data-title="As It Was" data-artist="Harry Styles" data-album-art="https://placehold.co/64x64/ff6347/ffffff?text=AIW" data-source="youtube">
|
||||||
|
<img src="https://placehold.co/64x64/ff6347/ffffff?text=AIW" alt="Album Art">
|
||||||
|
<div class="track-info">
|
||||||
|
<div class="track-title">As It Was</div>
|
||||||
|
<div class="artist-name">Harry Styles</div>
|
||||||
|
</div>
|
||||||
|
<i class="bi bi-youtube source-icon"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Pass PHP variables to JavaScript
|
||||||
|
const currentSessionCode = "<?php echo htmlspecialchars($session_code, ENT_QUOTES, 'UTF-8'); ?>";
|
||||||
|
</script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
22
privacy.php
Normal file
22
privacy.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
<?php
|
||||||
|
//This is a stub file for the privacy policy.
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Privacy Policy - SyncUp</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container mt-5">
|
||||||
|
<h1>Privacy Policy</h1>
|
||||||
|
<p>This is a placeholder for the Privacy Policy page.</p>
|
||||||
|
<p>Information regarding data collection, usage, and user rights will be detailed here.</p>
|
||||||
|
<a href="/" class="btn btn-primary">Go back to Home</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
98
session.php
Normal file
98
session.php
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_GET['id'])) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$session_id = $_GET['id'];
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM sessions WHERE id = ?");
|
||||||
|
$stmt->execute([$session_id]);
|
||||||
|
$session = $stmt->fetch();
|
||||||
|
|
||||||
|
if (!$session) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$page_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'];
|
||||||
|
$join_url = $page_url . '/join.php?code=' . $session['session_code'];
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>SyncUp Session</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--bg-dark: #121212;
|
||||||
|
--bg-surface: #1E1E1E;
|
||||||
|
--primary-green: #1DB954;
|
||||||
|
--text-light: #FFFFFF;
|
||||||
|
--text-secondary: #B3B3B3;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
background-color: var(--bg-dark);
|
||||||
|
color: var(--text-light);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
}
|
||||||
|
.session-container {
|
||||||
|
background-color: var(--bg-surface);
|
||||||
|
padding: 3rem;
|
||||||
|
border-radius: 12px;
|
||||||
|
text-align: center;
|
||||||
|
max-width: 400px;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
.qr-code {
|
||||||
|
background-color: white;
|
||||||
|
padding: 1rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.qr-code img {
|
||||||
|
max-width: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.session-code {
|
||||||
|
font-size: 3rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.5rem;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
color: var(--primary-green);
|
||||||
|
padding-left: 0.5rem; /* To align with letter spacing */
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
color: var(--text-secondary);
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="session-container">
|
||||||
|
<h1>Scan to Join Session</h1>
|
||||||
|
<div class="qr-code">
|
||||||
|
<img src="https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=<?php echo urlencode($join_url); ?>" alt="QR Code to join session">
|
||||||
|
</div>
|
||||||
|
<p>Or enter the code:</p>
|
||||||
|
<div class="session-code"><?php echo htmlspecialchars($session['session_code']); ?></div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
16
sitemap.xml
Normal file
16
sitemap.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
|
<url>
|
||||||
|
<loc>http://localhost/</loc>
|
||||||
|
<lastmod>2025-10-17</lastmod>
|
||||||
|
<changefreq>monthly</changefreq>
|
||||||
|
<priority>1.0</priority>
|
||||||
|
</url>
|
||||||
|
<url>
|
||||||
|
<loc>http://localhost/privacy.php</loc>
|
||||||
|
<lastmod>2025-10-17</lastmod>
|
||||||
|
<changefreq>yearly</changefreq>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>
|
||||||
|
</urlset>
|
||||||
Loading…
x
Reference in New Issue
Block a user