saved emails, gmail, hotmail start, home, landing etc
This commit is contained in:
33
inc/php/view_email.php
Normal file
33
inc/php/view_email.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// /inc/php/view_email.php
|
||||
session_start();
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/inc/php/auth.php');
|
||||
requireLogin();
|
||||
|
||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/db.php');
|
||||
$conn = getConnection();
|
||||
|
||||
$user_id = $_SESSION['user_id'] ?? null;
|
||||
$id = intval($_GET['id'] ?? 0);
|
||||
|
||||
$stmt = $conn->prepare("SELECT subject, body, created_at FROM saved_emails WHERE id = ? AND user_id = ?");
|
||||
$stmt->bind_param("ii", $id, $user_id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
$email = $result->fetch_assoc();
|
||||
|
||||
include($_SERVER['DOCUMENT_ROOT'] . '/inc/php/header.php');
|
||||
?>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<?php if ($email): ?>
|
||||
<h1><?= htmlspecialchars($email['subject'] ?: '(No Subject)') ?></h1>
|
||||
<p><em>Saved on <?= $email['created_at'] ?></em></p>
|
||||
<pre><?= htmlspecialchars($email['body']) ?></pre>
|
||||
<a href="/inc/php/saved.php"><button>⬅ Back</button></a>
|
||||
<?php else: ?>
|
||||
<p>Email not found ❌</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php include($_SERVER['DOCUMENT_ROOT'] . '/inc/php/footer.php'); ?>
|
||||
Reference in New Issue
Block a user