![]() 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/admin/ |
<?php
session_start();
require_once '../config/database.php';
// Check if user is admin (you can modify this check as needed)
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
header('Location: login.php');
exit;
}
$pdo = getDBConnection();
// Handle form submissions
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['action'])) {
switch ($_POST['action']) {
case 'add':
$stmt = $pdo->prepare("INSERT INTO player_messages (text, type, priority) VALUES (?, ?, ?)");
$stmt->execute([$_POST['text'], $_POST['type'], $_POST['priority'] ?? 0]);
break;
case 'update':
$stmt = $pdo->prepare("UPDATE player_messages SET text = ?, type = ?, priority = ?, is_active = ? WHERE id = ?");
$isActive = isset($_POST['is_active']) ? 1 : 0;
$stmt->execute([$_POST['text'], $_POST['type'], $_POST['priority'] ?? 0, $isActive, $_POST['id']]);
break;
case 'delete':
$stmt = $pdo->prepare("DELETE FROM player_messages WHERE id = ?");
$stmt->execute([$_POST['id']]);
break;
case 'toggle':
$stmt = $pdo->prepare("UPDATE player_messages SET is_active = NOT is_active WHERE id = ?");
$stmt->execute([$_POST['id']]);
break;
}
// Redirect to refresh the page
header('Location: player_messages.php');
exit;
}
}
// Fetch all messages
$stmt = $pdo->prepare("SELECT * FROM player_messages ORDER BY priority DESC, created_at ASC");
$stmt->execute();
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Player Messages Admin - SoundStudioPro</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root {
--primary: #667eea;
--secondary: #764ba2;
--accent: #4facfe;
--bg-primary: #0a0a0a;
--bg-secondary: #1a1a1a;
--bg-card: rgba(26, 26, 26, 0.9);
--text-primary: #ffffff;
--text-secondary: #a0aec0;
--border-light: rgba(255, 255, 255, 0.1);
--shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: var(--bg-primary);
color: var(--text-primary);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
line-height: 1.6;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.header {
background: var(--bg-secondary);
padding: 20px;
border-radius: 12px;
margin-bottom: 30px;
border: 1px solid var(--border-light);
}
.header h1 {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 10px;
}
.header p {
color: var(--text-secondary);
}
.add-message-form {
background: var(--bg-card);
padding: 25px;
border-radius: 12px;
margin-bottom: 30px;
border: 1px solid var(--border-light);
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
margin-bottom: 8px;
color: var(--text-primary);
font-weight: 600;
}
.form-group input,
.form-group textarea,
.form-group select {
width: 100%;
padding: 12px;
border: 1px solid var(--border-light);
border-radius: 8px;
background: var(--bg-secondary);
color: var(--text-primary);
font-size: 14px;
}
.form-group textarea {
resize: vertical;
min-height: 80px;
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
}
.btn {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: var(--text-primary);
border: none;
padding: 12px 24px;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-medium);
}
.btn-danger {
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}
.btn-success {
background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
}
.messages-list {
background: var(--bg-card);
border-radius: 12px;
border: 1px solid var(--border-light);
overflow: hidden;
}
.message-item {
display: grid;
grid-template-columns: 1fr 100px 80px 100px 120px;
gap: 20px;
padding: 20px;
border-bottom: 1px solid var(--border-light);
align-items: center;
}
.message-item:last-child {
border-bottom: none;
}
.message-item:hover {
background: var(--bg-secondary);
}
.message-text {
font-weight: 500;
}
.message-type {
padding: 4px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 600;
text-align: center;
}
.type-heart { background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%); }
.type-star { background: linear-gradient(135deg, #ffd93d 0%, #ffb142 100%); color: #2c3e50; }
.type-fire { background: linear-gradient(135deg, #ff7675 0%, #d63031 100%); }
.type-music { background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%); }
.type-rainbow { background: linear-gradient(135deg, #fd79a8 0%, #fdcb6e 50%, #6c5ce7 100%); }
.message-priority {
text-align: center;
font-weight: 600;
}
.message-status {
text-align: center;
}
.status-active {
color: #51cf66;
}
.status-inactive {
color: #ff6b6b;
}
.message-actions {
display: flex;
gap: 8px;
}
.btn-small {
padding: 6px 12px;
font-size: 12px;
}
.preview-section {
background: var(--bg-card);
padding: 25px;
border-radius: 12px;
margin-bottom: 30px;
border: 1px solid var(--border-light);
}
.preview-messages {
background: var(--bg-secondary);
border: 1px solid var(--border-light);
border-radius: 8px;
height: 50px;
display: flex;
align-items: center;
padding: 0 15px;
overflow: hidden;
position: relative;
}
.preview-container {
display: flex;
gap: 10px;
animation: scrollMessages 15s linear infinite;
}
.preview-message {
background: var(--primary);
color: var(--text-primary);
padding: 8px 12px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
white-space: nowrap;
display: flex;
align-items: center;
gap: 8px;
}
@keyframes scrollMessages {
0% { transform: translateX(100%); }
100% { transform: translateX(-100%); }
}
@media (max-width: 768px) {
.form-row {
grid-template-columns: 1fr;
}
.message-item {
grid-template-columns: 1fr;
gap: 10px;
}
.message-actions {
justify-content: center;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🎵 Player Messages Admin</h1>
<p>Manage the scrolling messages that appear in the music player. These messages will scroll across the player interface to engage users.</p>
</div>
<!-- Add New Message Form -->
<div class="add-message-form">
<h2>Add New Message</h2>
<form method="POST">
<input type="hidden" name="action" value="add">
<div class="form-group">
<label for="text">Message Text</label>
<textarea name="text" id="text" placeholder="Enter your message here..." required></textarea>
</div>
<div class="form-row">
<div class="form-group">
<label for="type">Message Type</label>
<select name="type" id="type" required>
<option value="heart">❤️ Heart</option>
<option value="star">⭐ Star</option>
<option value="fire">🔥 Fire</option>
<option value="music">🎵 Music</option>
<option value="rainbow">🌈 Rainbow</option>
</select>
</div>
<div class="form-group">
<label for="priority">Priority (0-10)</label>
<input type="number" name="priority" id="priority" min="0" max="10" value="0">
</div>
<div class="form-group">
<label> </label>
<button type="submit" class="btn">Add Message</button>
</div>
</div>
</form>
</div>
<!-- Preview Section -->
<div class="preview-section">
<h2>Live Preview</h2>
<div class="preview-messages">
<div class="preview-container">
<?php foreach ($messages as $message): ?>
<?php if ($message['is_active']): ?>
<div class="preview-message type-<?php echo $message['type']; ?>">
<i class="fas fa-<?php echo $message['type']; ?>"></i>
<span><?php echo htmlspecialchars($message['text']); ?></span>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
</div>
<!-- Messages List -->
<div class="messages-list">
<div class="message-item" style="background: var(--bg-secondary); font-weight: 600;">
<div>Message</div>
<div>Type</div>
<div>Priority</div>
<div>Status</div>
<div>Actions</div>
</div>
<?php foreach ($messages as $message): ?>
<div class="message-item">
<div class="message-text"><?php echo htmlspecialchars($message['text']); ?></div>
<div class="message-type type-<?php echo $message['type']; ?>">
<?php echo ucfirst($message['type']); ?>
</div>
<div class="message-priority"><?php echo $message['priority']; ?></div>
<div class="message-status">
<span class="status-<?php echo $message['is_active'] ? 'active' : 'inactive'; ?>">
<?php echo $message['is_active'] ? 'Active' : 'Inactive'; ?>
</span>
</div>
<div class="message-actions">
<form method="POST" style="display: inline;">
<input type="hidden" name="action" value="toggle">
<input type="hidden" name="id" value="<?php echo $message['id']; ?>">
<button type="submit" class="btn btn-small <?php echo $message['is_active'] ? 'btn-danger' : 'btn-success'; ?>">
<?php echo $message['is_active'] ? 'Disable' : 'Enable'; ?>
</button>
</form>
<form method="POST" style="display: inline;" onsubmit="return confirm('Are you sure you want to delete this message?')">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="id" value="<?php echo $message['id']; ?>">
<button type="submit" class="btn btn-small btn-danger">Delete</button>
</form>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<script>
// Auto-refresh preview every 30 seconds
setInterval(() => {
location.reload();
}, 30000);
</script>
</body>
</html>