113 lines
5.6 KiB
PHP
113 lines
5.6 KiB
PHP
<?php
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->query("SELECT id, name, email, status FROM members ORDER BY name");
|
|
$members = $stmt->fetchAll();
|
|
} catch (PDOException $e) {
|
|
// For a real app, you'd want to log this error and show a user-friendly message.
|
|
$members = [];
|
|
$error_message = "Database error: Could not fetch members.";
|
|
}
|
|
|
|
$projectName = $_SERVER['PROJECT_NAME'] ?? 'Whop Creator Cashback Messenger';
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title><?php echo htmlspecialchars($projectName); ?></title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
<meta name="description" content="An app for creators on Whop.com to send messages to members.">
|
|
<meta name="robots" content="noindex, nofollow">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="toast-container">
|
|
<!-- Toasts will be injected here by JS -->
|
|
</div>
|
|
|
|
<div class="container-fluid">
|
|
<header class="pb-3 mb-4 border-bottom">
|
|
<h1 class="display-5 text-center fw-bold"><?php echo htmlspecialchars($projectName); ?></h1>
|
|
<p class="text-center text-muted">Engage your members and boost your reviews.</p>
|
|
</header>
|
|
|
|
<?php if (isset($error_message)): ?>
|
|
<div class="alert alert-danger" role="alert">
|
|
<?php echo htmlspecialchars($error_message); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="row">
|
|
<!-- Member List -->
|
|
<div class="col-lg-5 mb-4 mb-lg-0">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<i class="fas fa-users me-2"></i> Your Members (<?php echo count($members); ?>)
|
|
</div>
|
|
<ul class="list-group list-group-flush">
|
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
<div class="form-check">
|
|
<input class="form-check-input" type="checkbox" id="selectAll">
|
|
<label class="form-check-label fw-bold" for="selectAll">Select All</label>
|
|
</div>
|
|
</li>
|
|
<div style="max-height: 450px; overflow-y: auto;">
|
|
<?php foreach ($members as $member): ?>
|
|
<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
<div class="form-check">
|
|
<input class="form-check-input member-checkbox" type="checkbox" value="<?php echo $member['id']; ?>" id="member_<?php echo $member['id']; ?>">
|
|
<label class="form-check-label" for="member_<?php echo $member['id']; ?>">
|
|
<?php echo htmlspecialchars($member['name']); ?><br>
|
|
<small class="text-muted"><?php echo htmlspecialchars($member['email']); ?></small>
|
|
</label>
|
|
</div>
|
|
<span class="badge bg-<?php echo $member['status'] === 'active' ? 'success' : 'secondary'; ?> rounded-pill"><?php echo htmlspecialchars($member['status']); ?></span>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Message Composer -->
|
|
<div class="col-lg-7">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<i class="fas fa-paper-plane me-2"></i> Compose Message
|
|
</div>
|
|
<div class="card-body">
|
|
<form>
|
|
<div class="mb-3">
|
|
<label for="subject" class="form-label">Subject</label>
|
|
<input type="text" class="form-control" id="subject" placeholder="e.g., A special thank you & request!">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="message" class="form-label">Message</label>
|
|
<textarea class="form-control" id="message" rows="8" placeholder="Hi {{name}}, thanks for being a valued member! As a token of our appreciation, we'd love to offer you cashback for a 5-star review..."></textarea>
|
|
<div class="form-text">You can use {{name}} as a placeholder.</div>
|
|
</div>
|
|
<div class="d-flex justify-content-end">
|
|
<button type="submit" id="sendMessage" class="btn btn-primary">Send Message</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<footer class="py-3 my-4">
|
|
<p class="text-center text-muted">© <?php echo date("Y"); ?> <?php echo htmlspecialchars($projectName); ?></p>
|
|
</footer>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script> <!-- For icons -->
|
|
</body>
|
|
</html>
|