Commit inicial con archivos existentes
This commit is contained in:
58
preview_message.php
Executable file
58
preview_message.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/includes/session_check.php';
|
||||
require_once __DIR__ . '/includes/db.php';
|
||||
require_once __DIR__ . '/config/config.php'; // Needed for the url() function
|
||||
|
||||
// Validate that an ID is provided
|
||||
if (!isset($_GET['id']) || !is_numeric($_GET['id'])) {
|
||||
http_response_code(400);
|
||||
die('Error: No se proporcionó un ID de mensaje válido.');
|
||||
}
|
||||
|
||||
$messageId = (int)$_GET['id'];
|
||||
|
||||
// Fetch the message content from the database
|
||||
$stmt = $pdo->prepare("SELECT content FROM messages WHERE id = ?");
|
||||
$stmt->execute([$messageId]);
|
||||
$message = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$message) {
|
||||
http_response_code(404);
|
||||
die('Error: Mensaje no encontrado.');
|
||||
}
|
||||
|
||||
$content = $message['content'];
|
||||
$baseUrl = rtrim(BOT_BASE_URL, '/') . '/';
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Vista Previa del Mensaje</title>
|
||||
<!-- Bootstrap CSS for consistent styling -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Base URL to resolve relative paths for images -->
|
||||
<base href="<?php echo htmlspecialchars($baseUrl); ?>">
|
||||
<style>
|
||||
/* Optional: Add some basic styling for the preview */
|
||||
body {
|
||||
background-color: #f8f9fa;
|
||||
padding: 20px;
|
||||
}
|
||||
.preview-container {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 0.25rem;
|
||||
padding: 2rem;
|
||||
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container preview-container">
|
||||
<?php echo $content; // Output the raw HTML content ?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user