![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/private_html/ |
<?php
session_start();
require_once 'config/database.php';
require_once 'includes/translations.php';
$eventId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if ($eventId <= 0) {
header('Location: /events.php');
exit;
}
$pdo = getDBConnection();
$stmt = $pdo->prepare("
SELECT
e.*,
u.name AS creator_name
FROM events e
JOIN users u ON e.creator_id = u.id
WHERE e.id = ? AND e.status = 'published'
LIMIT 1
");
$stmt->execute([$eventId]);
$event = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$event) {
header('Location: /events.php');
exit;
}
// IMPORTANT: Allow bots/crawlers (like Facebook scraper) to access events even without session
// This is critical for Facebook, Twitter, etc. to scrape the page and show previews
$isBot = isset($_SERVER['HTTP_USER_AGENT']) && (
stripos($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit') !== false ||
stripos($_SERVER['HTTP_USER_AGENT'], 'Twitterbot') !== false ||
stripos($_SERVER['HTTP_USER_AGENT'], 'LinkedInBot') !== false ||
stripos($_SERVER['HTTP_USER_AGENT'], 'WhatsApp') !== false ||
stripos($_SERVER['HTTP_USER_AGENT'], 'bot') !== false ||
stripos($_SERVER['HTTP_USER_AGENT'], 'crawler') !== false ||
stripos($_SERVER['HTTP_USER_AGENT'], 'spider') !== false
);
// Check if event is a private password party
// Only check if columns exist and are explicitly set to private
$is_private_party = false;
$has_password = false;
// Check if columns exist in the result (they might not exist if migration hasn't run)
if (isset($event['is_private_party'])) {
$is_private_party = ((int)$event['is_private_party'] === 1 || $event['is_private_party'] === true);
}
if (isset($event['party_password']) && !empty(trim($event['party_password']))) {
$has_password = true;
}
// Only apply password protection if BOTH conditions are met: is private AND has password
// IMPORTANT: Always allow bots to access private events for OG tags (they need the metadata for social sharing)
if ($is_private_party && $has_password) {
$user_id = $_SESSION['user_id'] ?? null;
$is_creator = $user_id && $user_id == $event['creator_id'];
// Creator can always access
// Bots always get access for OG tag scraping (even without password)
// This ensures social media platforms can always scrape the page metadata
if (!$is_creator && !$isBot) {
// Check if user has valid session access
$has_access = isset($_SESSION['party_access_' . $eventId]) &&
isset($_SESSION['party_access_time_' . $eventId]) &&
(time() - $_SESSION['party_access_time_' . $eventId]) < 3600; // 1 hour access
if (!$has_access) {
// Redirect to party gate
header('Location: /party_gate.php?id=' . $eventId);
exit;
}
}
// Bot, creator, or has valid access - allow access (continue)
}
$host = $_SERVER['HTTP_HOST'] ?? 'soundstudiopro.com';
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https://' : 'http://';
$baseUrl = $scheme . $host;
$title = $event['title'] ?? 'Event';
$rawDescription = $event['description'] ?? '';
$description = trim(strip_tags($rawDescription));
if (strlen($description) > 180) {
$description = substr($description, 0, 177) . '...';
}
function buildAbsoluteEventUrl(string $path, string $baseUrl): string {
if ($path === '') {
return $baseUrl . '/assets/images/og-image.png';
}
if (preg_match('/^https?:\\/\\//i', $path)) {
return $path;
}
if ($path[0] !== '/') {
$path = '/' . $path;
}
return $baseUrl . $path;
}
$coverImage = buildAbsoluteEventUrl($event['cover_image'] ?? '', $baseUrl);
$page_title = $title . ' - ' . t('events.title', 'Events') . ' - SoundStudioPro';
$page_description = $description ?: 'Discover this event on SoundStudioPro.';
$og_title = $title;
$og_description = $page_description;
$og_image = $coverImage;
$canonical_url = $baseUrl . '/event_details.php?id=' . $eventId;
include 'includes/header.php';
?>
<style>
.event-preview-container {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: radial-gradient(circle at top, rgba(79,172,254,0.25), rgba(10,10,10,0.95));
color: #fff;
padding: 4rem 2rem;
}
.event-preview-card {
max-width: 720px;
width: 100%;
background: rgba(15, 23, 42, 0.9);
border-radius: 24px;
border: 1px solid rgba(255, 255, 255, 0.08);
box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
overflow: hidden;
}
.event-preview-cover {
width: 100%;
height: 320px;
background-size: cover;
background-position: center;
position: relative;
}
.event-preview-cover::after {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(180deg, rgba(0,0,0,0.2), rgba(0,0,0,0.7));
}
.event-preview-body {
padding: 2.5rem;
}
.event-preview-body h1 {
margin: 0 0 1rem;
font-size: 2.4rem;
}
.event-preview-meta {
display: flex;
flex-wrap: wrap;
gap: 1rem;
font-size: 0.95rem;
color: #cbd5f5;
margin-bottom: 1.5rem;
}
.event-preview-description {
position: relative;
margin-bottom: 2rem;
padding: 1.5rem 1.8rem 1.5rem 2.3rem;
border-radius: 20px;
background: linear-gradient(135deg, rgba(99, 102, 241, 0.16), rgba(14, 165, 233, 0.08));
border: 1px solid rgba(168, 182, 255, 0.35);
box-shadow: 0 20px 38px rgba(5, 10, 30, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
overflow: hidden;
}
.event-preview-description::before {
content: '';
position: absolute;
top: 1.5rem;
left: 1.3rem;
width: 4px;
height: calc(100% - 3rem);
border-radius: 999px;
background: linear-gradient(180deg, #a5b4fc, #60a5fa, #38bdf8);
box-shadow: 0 0 18px rgba(96, 165, 250, 0.75);
}
.event-preview-description::after {
content: '';
position: absolute;
inset: 0;
background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent 60%);
pointer-events: none;
}
.event-preview-description-content {
font-size: 1.08rem;
text-transform: uppercase;
letter-spacing: 0.05em;
font-weight: 800;
line-height: 1.9;
background: linear-gradient(120deg, #f093fb, #4facfe);
background-clip: border-box;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-shadow: 0 0 15px rgba(79, 172, 254, 0.35);
}
.event-preview-description-content br {
content: '';
}
.event-preview-actions {
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
.event-preview-actions a {
text-decoration: none;
}
.event-preview-actions button {
border: none;
border-radius: 14px;
padding: 0.9rem 1.8rem;
font-weight: 600;
cursor: pointer;
transition: transform 0.2s ease, box-shadow 0.2s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.event-preview-actions button:focus {
outline: 2px solid rgba(102, 126, 234, 0.6);
outline-offset: 3px;
}
.btn-primary {
background: linear-gradient(135deg, #667eea, #764ba2);
color: #fff;
box-shadow: 0 12px 25px rgba(102, 126, 234, 0.35);
}
.btn-outline {
background: transparent;
color: #d1d5db;
border: 1px solid rgba(255,255,255,0.25);
}
.event-preview-note {
margin-top: 1.5rem;
font-size: 0.9rem;
color: #9ca3af;
}
</style>
<div class="event-preview-container">
<div class="event-preview-card">
<div class="event-preview-cover" style="background-image: url('<?= htmlspecialchars($coverImage, ENT_QUOTES, 'UTF-8') ?>');"></div>
<div class="event-preview-body">
<h1><?= htmlspecialchars($title) ?></h1>
<div class="event-preview-meta">
<span><i class="fas fa-user"></i> <?= htmlspecialchars($event['creator_name']) ?></span>
<?php if (!empty($event['start_date'])): ?>
<span><i class="fas fa-calendar"></i> <?= date('M j, Y g:i A', strtotime($event['start_date'])) ?></span>
<?php endif; ?>
<?php if (!empty($event['location'])): ?>
<span><i class="fas fa-map-marker-alt"></i> <?= htmlspecialchars($event['location']) ?></span>
<?php endif; ?>
</div>
<?php if (!empty($rawDescription)): ?>
<div class="event-preview-description">
<div class="event-preview-description-content">
<?= nl2br(htmlspecialchars($rawDescription)) ?>
</div>
</div>
<?php endif; ?>
<div class="event-preview-actions">
<a href="/events.php?event=<?= $eventId ?>">
<button class="btn-primary">
<i class="fas fa-play-circle"></i>
<?= t('events.view_event', 'View Event') ?>
</button>
</a>
<button class="btn-outline" onclick="shareThisEvent(<?= $eventId ?>)">
<i class="fas fa-share-alt"></i>
<?= t('events.share', 'Share') ?>
</button>
</div>
<p class="event-preview-note">
<?= t('events.redirect_notice', 'You will be redirected to the full event experience momentarily.') ?>
</p>
</div>
</div>
</div>
<script>
function shareThisEvent(eventId) {
const url = `${window.location.origin}/event_details.php?id=${eventId}`;
if (navigator.share) {
navigator.share({
title: document.title,
url
}).catch(() => {});
} else if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(url).then(() => {
alert('Event link copied to clipboard!');
}).catch(() => {
window.prompt('Copy this event link:', url);
});
} else {
window.prompt('Copy this event link:', url);
}
}
setTimeout(() => {
if (!document.hidden) {
window.location.href = '/events.php?event=<?= $eventId ?>';
}
}, 1500);
</script>
<?php include 'includes/footer.php'; ?>
<?php
$eventId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if ($eventId <= 0) {
header('Location: /events.php');
exit;
}
$query = http_build_query(['event' => $eventId]);
header('Location: /events.php?' . $query);
exit;