36692-vm/services/emailnewsletters.php
2025-12-05 20:00:32 +00:00

41 lines
1.1 KiB
PHP

<?php
require_once '../includes/header.php';
require_once '../db/config.php';
if (!isset($_SESSION['user_id'])) {
header('Location: ../login.php');
exit();
}
$user_id = $_SESSION['user_id'];
// Get the service ID for 'Email Newsletters'
$p = db()->prepare('SELECT id FROM services WHERE name = ?');
$p->execute(['Email Newsletters']);
$service = $p->fetch();
if (!$service) {
die('Email service not found.');
}
$service_id = $service['id'];
// Check if the user is subscribed to this service
$p = db()->prepare('SELECT * FROM user_services WHERE user_id = ? AND service_id = ?');
$p->execute([$user_id, $service_id]);
$subscription = $p->fetch();
if (!$subscription) {
die('You are not subscribed to this service. <a href="../subscribe.php">Subscribe now</a>');
}
?>
<div class="container">
<h1 class="mt-5">Email Newsletters</h1>
<p class="lead">This is where the email newsletter functionality would be.</p>
<p>You could have a list of past newsletters here, or a form to manage your subscription preferences.</p>
</div>
<?php require_once '../includes/footer.php'; ?>