![]() 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/public_html/ |
<?php
session_start();
require_once 'config/database.php';
// Only allow admin to run this
if (!isset($_SESSION['user_id']) || !isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
die('Access denied. Admin only.');
}
$pdo = getDBConnection();
echo "<h1>🎪 Creating Events Database Tables</h1>";
try {
// Events table
$pdo->exec("
CREATE TABLE IF NOT EXISTS events (
id INT AUTO_INCREMENT PRIMARY KEY,
creator_id INT NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT,
event_type ENUM('live_music', 'workshop', 'networking', 'release_party', 'battle', 'open_mic', 'studio_session', 'other') DEFAULT 'other',
location VARCHAR(255),
venue_name VARCHAR(255),
address TEXT,
latitude DECIMAL(10, 8),
longitude DECIMAL(11, 8),
start_date DATETIME NOT NULL,
end_date DATETIME NOT NULL,
timezone VARCHAR(50) DEFAULT 'UTC',
max_attendees INT DEFAULT NULL,
current_attendees INT DEFAULT 0,
ticket_price DECIMAL(10, 2) DEFAULT 0.00,
is_free BOOLEAN DEFAULT TRUE,
cover_image VARCHAR(255),
banner_image VARCHAR(255),
tags JSON,
status ENUM('draft', 'published', 'cancelled', 'completed') DEFAULT 'draft',
is_featured BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
FOREIGN KEY (creator_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
");
echo "<p>✅ Created events table</p>";
// Event attendees table
$pdo->exec("
CREATE TABLE IF NOT EXISTS event_attendees (
id INT AUTO_INCREMENT PRIMARY KEY,
event_id INT NOT NULL,
user_id INT NOT NULL,
status ENUM('attending', 'maybe', 'not_attending') DEFAULT 'attending',
rsvp_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
notes TEXT,
UNIQUE KEY unique_rsvp (event_id, user_id),
FOREIGN KEY (event_id) REFERENCES events(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
)
");
echo "<p>✅ Created event_attendees table</p>";
// Event comments table
$pdo->exec("
CREATE TABLE IF NOT EXISTS event_comments (
id INT AUTO_INCREMENT PRIMARY KEY,
event_id INT NOT NULL,
user_id INT NOT NULL,
comment TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (event_id) REFERENCES events(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
");
echo "<p>✅ Created event_comments table</p>";
// Event likes table
$pdo->exec("
CREATE TABLE IF NOT EXISTS event_likes (
id INT AUTO_INCREMENT PRIMARY KEY,
event_id INT NOT NULL,
user_id INT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY unique_like (event_id, user_id),
FOREIGN KEY (event_id) REFERENCES events(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
)
");
echo "<p>✅ Created event_likes table</p>";
// Event shares table
$pdo->exec("
CREATE TABLE IF NOT EXISTS event_shares (
id INT AUTO_INCREMENT PRIMARY KEY,
event_id INT NOT NULL,
user_id INT NOT NULL,
platform VARCHAR(50),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (event_id) REFERENCES events(id) ON DELETE CASCADE,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
)
");
echo "<p>✅ Created event_shares table</p>";
// Event categories table
$pdo->exec("
CREATE TABLE IF NOT EXISTS event_categories (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
description TEXT,
icon VARCHAR(50),
color VARCHAR(7),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
");
echo "<p>✅ Created event_categories table</p>";
// Insert default event categories
$categories = [
['Live Music', 'Concerts, performances, and live shows', 'fas fa-music', '#667eea'],
['Workshop', 'Music production and learning events', 'fas fa-graduation-cap', '#48bb78'],
['Networking', 'Meet other artists and collaborators', 'fas fa-users', '#ed8936'],
['Release Party', 'Album and track launch events', 'fas fa-champagne-glasses', '#9f7aea'],
['Battle', 'Competitive music events', 'fas fa-trophy', '#f56565'],
['Open Mic', 'Showcase your talent', 'fas fa-microphone', '#38b2ac'],
['Studio Session', 'Collaborative recording events', 'fas fa-record-vinyl', '#ed64a6'],
['Other', 'Miscellaneous events', 'fas fa-calendar', '#a0aec0']
];
$stmt = $pdo->prepare("INSERT IGNORE INTO event_categories (name, description, icon, color) VALUES (?, ?, ?, ?)");
foreach ($categories as $category) {
$stmt->execute($category);
}
echo "<p>✅ Inserted default event categories</p>";
echo "<h2>🎉 Events database setup complete!</h2>";
echo "<p>Your events system is ready to use.</p>";
echo "<p><a href='/events.php' style='color: #667eea; text-decoration: none;'>View Events Page →</a></p>";
} catch (Exception $e) {
echo "<p style='color: red;'>Error: " . $e->getMessage() . "</p>";
}
?>
<style>
body {
font-family: 'Inter', sans-serif;
background: #0a0a0a;
color: white;
padding: 2rem;
line-height: 1.6;
}
h1 {
color: #667eea;
margin-bottom: 2rem;
}
h2 {
color: #764ba2;
margin-top: 2rem;
}
p {
margin: 0.5rem 0;
}
a {
color: #667eea;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
</style>