Auto commit: 2026-01-31T00:27:08.101Z
This commit is contained in:
parent
df7208c661
commit
813ebdfe6d
73
index.php
73
index.php
@ -16,7 +16,7 @@ $logoImage = "assets/pasted-20260131-002028-7985dfae.png";
|
||||
// Fetch latest requests
|
||||
$requests = [];
|
||||
try {
|
||||
$stmt = db()->query("SELECT name, message, created_at FROM listener_requests ORDER BY created_at DESC LIMIT 10");
|
||||
$stmt = db()->query("SELECT name, phone, message, created_at FROM listener_requests ORDER BY created_at DESC LIMIT 20");
|
||||
$requests = $stmt->fetchAll();
|
||||
} catch (Exception $e) {
|
||||
// Silently fail if table doesn't exist yet or other DB error
|
||||
@ -147,7 +147,7 @@ try {
|
||||
box-shadow: 0 20px 50px rgba(0,0,0,0.4);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 600px;
|
||||
max-height: 700px;
|
||||
}
|
||||
|
||||
.comments-header {
|
||||
@ -176,9 +176,15 @@ try {
|
||||
.comment-item {
|
||||
background: rgba(255,255,255,0.05);
|
||||
border-radius: 12px;
|
||||
padding: 0.8rem;
|
||||
margin-bottom: 0.8rem;
|
||||
padding: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
font-size: 0.9rem;
|
||||
position: relative;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.comment-item:hover {
|
||||
background: rgba(255,255,255,0.08);
|
||||
}
|
||||
|
||||
.comment-user {
|
||||
@ -199,11 +205,37 @@ try {
|
||||
margin-top: 0.4rem;
|
||||
}
|
||||
|
||||
.comment-actions {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
.btn-wa-reply {
|
||||
background: #25d366;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 0.9rem;
|
||||
transition: all 0.3s ease;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.btn-wa-reply:hover {
|
||||
transform: scale(1.1);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.request-form {
|
||||
margin-top: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.form-control-glass {
|
||||
@ -225,7 +257,7 @@ try {
|
||||
background: var(--primary-color);
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
padding: 0.6rem;
|
||||
padding: 0.7rem;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
@ -429,15 +461,15 @@ try {
|
||||
|
||||
<div class="comments-window">
|
||||
<div class="comments-header">
|
||||
<h5 class="mb-0"><i class="fas fa-comments me-2"></i>Peticiones y Comentarios</h5>
|
||||
<h5 class="mb-0"><i class="fas fa-comments me-2"></i>Mensajes de la Audiencia</h5>
|
||||
<span class="badge bg-danger rounded-pill"><?= count($requests) ?></span>
|
||||
</div>
|
||||
|
||||
<div class="comments-list" id="commentsList">
|
||||
<?php if (empty($requests)): ?>
|
||||
<div class="text-center py-4 opacity-50">
|
||||
<i class="fas fa-ghost fa-2x mb-2"></i>
|
||||
<p>No hay peticiones aún. ¡Sé el primero!</p>
|
||||
<div class="text-center py-5 opacity-50">
|
||||
<i class="fas fa-comment-dots fa-3x mb-3"></i>
|
||||
<p>No hay mensajes todavía.<br>¡Conéctate con Lili Records!</p>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($requests as $req): ?>
|
||||
@ -445,6 +477,14 @@ try {
|
||||
<span class="comment-user"><?= htmlspecialchars($req['name']) ?></span>
|
||||
<p class="comment-text mb-0"><?= htmlspecialchars($req['message']) ?></p>
|
||||
<span class="comment-date"><?= date('d M, H:i', strtotime($req['created_at'])) ?></span>
|
||||
|
||||
<?php if (!empty($req['phone'])): ?>
|
||||
<div class="comment-actions">
|
||||
<a href="https://wa.me/<?= preg_replace('/[^0-9]/', '', $req['phone']) ?>" class="btn-wa-reply" title="Chatear por WhatsApp" target="_blank">
|
||||
<i class="fab fa-whatsapp"></i>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
@ -455,14 +495,21 @@ try {
|
||||
</div>
|
||||
|
||||
<form action="submit_request.php" method="POST" class="request-form">
|
||||
<input type="text" name="name" class="form-control form-control-glass" placeholder="Tu nombre" required>
|
||||
<div class="row g-2">
|
||||
<div class="col-6">
|
||||
<input type="text" name="name" class="form-control form-control-glass" placeholder="Tu nombre" required>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<input type="text" name="phone" class="form-control form-control-glass" placeholder="WhatsApp (opcional)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<textarea name="message" class="form-control form-control-glass" rows="1" placeholder="Tu canción o mensaje..." required></textarea>
|
||||
<textarea name="message" class="form-control form-control-glass" rows="1" placeholder="Tu mensaje aquí..." required></textarea>
|
||||
<button type="submit" class="btn btn-send-request text-white">
|
||||
<i class="fas fa-paper-plane"></i>
|
||||
</button>
|
||||
</div>
|
||||
<small class="text-center opacity-50" style="font-size: 0.7rem;">Al enviar se abrirá WhatsApp</small>
|
||||
<small class="text-center opacity-50" style="font-size: 0.7rem;">Tu mensaje aparecerá aquí y se enviará por WhatsApp</small>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -4,17 +4,18 @@ require_once __DIR__ . '/db/config.php';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$name = $_POST['name'] ?? 'Anónimo';
|
||||
$phone = $_POST['phone'] ?? '';
|
||||
$message = $_POST['message'] ?? '';
|
||||
$whatsappNumber = "5359177041";
|
||||
$stationWhatsapp = "5359177041";
|
||||
|
||||
if (!empty($message)) {
|
||||
try {
|
||||
$stmt = db()->prepare("INSERT INTO listener_requests (name, message) VALUES (?, ?)");
|
||||
$stmt->execute([$name, $message]);
|
||||
$stmt = db()->prepare("INSERT INTO listener_requests (name, phone, message) VALUES (?, ?, ?)");
|
||||
$stmt->execute([$name, $phone, $message]);
|
||||
|
||||
// Redirect to WhatsApp
|
||||
$whatsappText = urlencode("Hola! Soy $name. Mi petición es: $message");
|
||||
$redirectUrl = "https://wa.me/$whatsappNumber?text=$whatsappText";
|
||||
// Redirect to Station WhatsApp
|
||||
$whatsappText = urlencode("Hola! Soy $name. Mi mensaje es: $message" . ($phone ? " (Mi WhatsApp: $phone)" : ""));
|
||||
$redirectUrl = "https://wa.me/$stationWhatsapp?text=$whatsappText";
|
||||
|
||||
header("Location: $redirectUrl");
|
||||
exit;
|
||||
@ -27,4 +28,4 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
exit;
|
||||
Loading…
x
Reference in New Issue
Block a user