OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
zzXpress
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
06/17/2025 10:17:24 AM
rwxrwxr-x
📄
.browserslistrc
208 bytes
01/07/2025 11:52:51 AM
rw-r--r--
📄
.gitignore
42 bytes
01/07/2025 11:52:51 AM
rw-r--r--
📄
.htaccess
803 bytes
01/07/2025 11:52:51 AM
rw-r--r--
📄
.htaccess.swp
12 KB
01/07/2025 11:52:52 AM
rw-r--r--
📄
.travis.yml
199 bytes
01/07/2025 11:52:52 AM
rw-r--r--
📄
addList.php
5.23 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
aditya_navbar.php
23.72 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
allTemplates.php
5 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
assets
-
01/07/2025 11:50:15 AM
rwxr-xr-x
📄
b_navbar.php
7.84 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
bbsns_subscribe.php
5.14 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
bcreateList.php
9.61 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
blacklist.php
13.36 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
bounceViewList.php
8.39 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
bounce_handler.php
4.99 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
bprocess_emails.php
6.73 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
checkNotificationTopics.php
5.11 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
check_identity
-
05/19/2025 10:07:22 AM
rwxr-xr-x
📄
checknotif.php
1.01 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
ckeditor.php
2.14 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
clickViewList.php
5.13 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
click_handler.php
1.75 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
combined.php
11.23 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
complaintsViewList.php
6.78 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
complaints_handler.php
2.89 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
composer.json
200 bytes
01/07/2025 11:52:56 AM
rw-r--r--
📄
composer.lock
39.12 KB
01/07/2025 11:52:56 AM
rw-r--r--
📄
createList.php
17.4 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
credentials
-
01/07/2025 11:52:11 AM
rwxr-xr-x
📄
csv.php
11.75 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
db.php
1000 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📄
deleteCampaign.php
966 bytes
05/19/2025 10:07:24 AM
rw-r--r--
📄
delete_list.php
509 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📄
delete_users.php
435 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📄
deliveryViewList.php
6.87 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
delivery_handler.php
3.25 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
download_Complaints.php
974 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📄
download_bounces.php
1.18 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
download_clicked.php
1.23 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
download_delivered.php
1.12 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
download_open.php
1.22 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
download_report.php
3.33 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
download_unique_open.php
1.6 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
duplicate_campaign.php
1.62 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
edit_campaign.php
1.45 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
edit_list.php
9.89 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
feedback.php
1.66 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
footer.php
1.7 KB
05/19/2025 10:07:22 AM
rw-r--r--
📁
grfx
-
01/07/2025 11:52:13 AM
rwxr-xr-x
📄
groupchatnavbar.php
607 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📄
himanshu_navbar.php
7.84 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
housekeeping.php
13.27 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
index.php
8.57 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
insert_list.php
2.64 KB
05/19/2025 10:07:22 AM
rw-r--r--
📁
js
-
01/07/2025 11:52:15 AM
rwxr-xr-x
📄
load.php
159 bytes
05/19/2025 10:07:24 AM
rw-r--r--
📁
log
-
01/07/2025 11:52:18 AM
rwxr-xr-x
📄
main.css
413 bytes
01/07/2025 11:53:01 AM
rw-r--r--
📄
navbar.php
23.77 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
newCompaign.php
11.12 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
openViewList.php
8.48 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
open_handler.php
1.75 KB
05/19/2025 10:07:24 AM
rw-r--r--
📁
process
-
05/19/2025 10:07:22 AM
rwxr-xr-x
📄
process_emails.php
11.31 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
real-recipients.csv
39.48 KB
01/07/2025 11:53:03 AM
rw-r--r--
📄
resubscribe.php
5.51 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
sample.csv
55 bytes
01/07/2025 11:53:03 AM
rw-r--r--
📄
save.php
252 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📄
save_campaign.php
612 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📄
saved_content.html
6.48 KB
01/07/2025 11:53:03 AM
rw-r--r--
📄
send_email.php
987 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📄
send_email_campaignGraph.php
2.24 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
sendgrid.php
3.62 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
showListMembers.php
13.98 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
showcase.php
7.93 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
sidebar.php
0 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📄
sns_subscribe.php
5.25 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
submit_form.php
2.48 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
test-mail.csv
337 bytes
01/07/2025 11:53:05 AM
rw-r--r--
📄
test.php
969 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📄
test_process_emails.php
1.91 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
unsubscribe.php
3.8 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
upload_image.php
606 bytes
05/19/2025 10:07:22 AM
rw-r--r--
📁
uploads
-
01/07/2025 11:52:34 AM
rwxr-xr-x
📁
vendor
-
05/19/2025 10:07:24 AM
rwxr-xr-x
📄
verify.html
486 bytes
01/07/2025 11:53:06 AM
rw-r--r--
📄
verify.php
3.12 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
verify_email.php
5.12 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
viewCampaign.php
23.92 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
viewList.php
15.04 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
xpress_handler.php
9.79 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
zcreateList.php
13.51 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
znewCompaign.php
8.29 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
zprocess_emails.php
10.19 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
zviewList.php
14.63 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
zzindex.php
10.24 KB
05/19/2025 10:07:24 AM
rw-r--r--
📄
zzviewCampaign.php
22.42 KB
05/19/2025 10:07:22 AM
rw-r--r--
📄
zzviewList.php
14.63 KB
05/19/2025 10:07:22 AM
rw-r--r--
Editing: zzviewCampaign.php
Close
<?php // Include necessary files include '../assets/php/validate.logged.php'; include 'db.php'; include '../assets/php/config.php'; include '../assets/php/function.php'; // Get the campaign ID from the query parameter $campaignId = isset($_GET['id']) ? intval($_GET['id']) : 0; // Fetch unique clicks, unique opens, bounces, and deliveries function fetch_campaign_data($conn, $campaignId) { $data = []; $queries = [ 'unique_clicks' => "SELECT COUNT(*) AS count FROM messages m INNER JOIN email_clicks ec ON ec.message_id = m.message_id WHERE m.campaign_id = ?", 'unique_opens' => "SELECT COUNT(*) AS count FROM messages m INNER JOIN email_opens eo ON eo.message_id = m.message_id WHERE m.campaign_id = ?", 'bounces' => "SELECT COUNT(*) AS count FROM bounces b INNER JOIN messages m ON m.message_id = b.message_id WHERE m.campaign_id = ?", 'deliveries' => "SELECT COUNT(*) AS count FROM deliveries d INNER JOIN messages m ON m.message_id = d.message_id WHERE m.campaign_id = ?" ]; foreach ($queries as $key => $query) { $stmt = $conn->prepare($query); $stmt->bind_param("i", $campaignId); $stmt->execute(); $result = $stmt->get_result(); $data[$key] = $result->fetch_assoc()['count']; $stmt->close(); } return $data; } // Fetch campaign details $campaignData = fetch_campaign_data($conn, $campaignId); $campaign = $conn->query("SELECT campaign_name, action, list_id, sent_date FROM campaigns WHERE id = $campaignId")->fetch_assoc(); $list = $conn->query("SELECT list_name FROM list WHERE id = {$campaign['list_id']}")->fetch_assoc(); ?> <!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Knobly Cream: Create • Reach • Measure</title> <!-- jQuery --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Font Awesome CSS --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.min.css" /> <link rel="stylesheet" href="../inc/fontawesome/css/all.min.css" /> <link rel="stylesheet" href="../inc/magnific-popup.css" /> <link rel="stylesheet" href="../inc/style.css" /> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" crossorigin="anonymous"></script> <script src="https://cdn.tiny.cloud/1/u5oz235qw5jiqww4udm90ocp9zg2rncblqo2ch0ym3twjgyt/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script> <script src="https://js.zohostatic.com/books/zfwidgets/assets/js/zf-widget.js"></script> <script src="../inc/jquery.magnific-popup.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.10.5/font/bootstrap-icons.min.css" rel="stylesheet"> <script src="../inc/common.js"></script> <script type="text/javascript"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-datalabels/2.0.0/chartjs-plugin-datalabels.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-datalabels/0.7.0/chartjs-plugin-datalabels.min.js"></script> <style> /* General Styles */ body { font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 20px; text-align: center; font-size: 14px; } h1 { color: #333; font-size: 1.8em; margin-bottom: 20px; font-weight: bold; padding-top: 35px; } /* Table Styles */ table { width: 100%; border-collapse: collapse; margin-top: 20px; margin-bottom: 20px; font-size: 14px; } table, th, td { border: 1px solid #ddd; } th, td { padding: 10px; text-align: left; } th { background-color: #f2f2f2; font-weight: bold; } td { background-color: #fff; } tr:nth-child(even) { background-color: #f9f9f9; } tr:hover { background-color: #f1f1f1; } /* Paragraph Styles */ p { font-size: 1em; color: #555; } /* Chart Container Styles */ .chart-container { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; } .chart { flex: 1; max-width: 500px; min-width: 300px; } /* Legend Styles */ .legend { display: flex; flex-direction: row; gap: 12px; margin-top: 10px; } .legend-item { display: flex; align-items: center; margin-bottom: 5px; } .legend-dot { width: 12px; height: 12px; border-radius: 50%; margin-right: 10px; } /* Breadcrumb Styles */ .breadcrumb { display: flex; flex-wrap: wrap; padding: .75rem 0rem; margin-bottom: 1rem; list-style: none; background-color: transparent; border-radius: .25rem; } .breadcrumb-item { display: flex; justify-content: space-between; align-items: center; } /* Form Control Styles */ .form-control { display: block; width: 100%; height: auto !important; padding: .375rem .75rem; font-size: 1rem; font-weight: 400; line-height: 1.5; color: #495057; background-color: #fff; background-clip: padding-box; border: 1px solid #ced4da; border-radius: .25rem; transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out; } /* Download Button Styling */ .btn-download { background-color: #007BFF; color: white; padding: 4px 8px; text-decoration: none; border-radius: 5px; font-size: 0.9em; /* margin-left: 10px; */ float: right; transition: background-color 0.3s ease-in-out; margin-right: 10px; } h2 { font-size: 1.5em; float: left; padding-top: 20px; } /* Media Query for mobile devices (screen width less than 768px) */ @media (max-width: 768px) { .chart-container { flex-direction: column; align-items: center; } .chart { width: 100%; max-width: none; } .breadcrumb-item { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; } .legend { flex-direction: column; gap: 8px; margin-top: 10px; } .breadcrumb { padding: 0.5rem 0; } /* Ensures spacing of h2 on smaller screens */ h2 { font-size: 1.5em; padding-top: 20px; margin-right: 0; float: left; } /* Adjusting table width and padding for mobile */ table { width: 100%; margin-top: 10px; margin-bottom: 10px; } th, td { padding: 8px; } } </style> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.10.5/font/bootstrap-icons.min.css" rel="stylesheet"> </head> <body class="sb-nav-fixed"> <?php include "navbar.php"; ?> <?php include "../assets/php/go_backbar.php"; ?> <div id="layoutSidenav"> <?php include 'sidebar.php'; ?> <div id="layoutSidenav_content"> <main> <div id="panelContent" class="container-fluid"> <div class="container mt-5"> <ol class="breadcrumb my-3"> <li class="breadcrumb-item w-100"> <h2>Campaign Details: <?= htmlspecialchars($campaign['campaign_name']) ?></h2> <button onclick="downloadPageImage()" class="btn btn-secondary">Download Report as Image</button> </li> </ol> <div class="mt-4"> <h4>Send Report Image via Email</h4> <input type="email" id="emailInput" class="form-control" placeholder="Enter recipient's email" required> <div class="mt-3"> <label for="imageUpload" class="form-label">Select an Image:</label> <input type="file" id="imageUpload" class="form-control" accept="image/*" required> </div> <div class="mt-3"> <button onclick="sendSelectedImage()" class="btn btn-primary">Send Report</button> </div> </div> <br> <div id="specificContent"> <p><strong>Campaign Name: </strong><?= htmlspecialchars($campaign['campaign_name']) ?></p> <p><strong>Action:</strong> <?= htmlspecialchars($campaign['action']) ?></p> <p><strong>List Name:</strong> <?= htmlspecialchars($list['list_name']) ?></p> <p><strong>Sent Date:</strong> <?= htmlspecialchars($campaign['sent_date']) ?></p> <div class="chart-container"> <!-- Pie Chart --> <div class="chart"> <canvas id="deliveriesBouncesChart"></canvas> </div> <!-- Bar Chart --> <div class="chart"> <canvas id="horizontalBarChart"></canvas> <div class="legend"> <div class="legend-item"> <div class="legend-dot" style="background-color: #4caf50;"></div> Delivered </div> <div class="legend-item"> <div class="legend-dot" style="background-color: #f44336;"></div> Bounces </div> <div class="legend-item"> <div class="legend-dot" style="background-color: #3f51b5;"></div> Unique Opens </div> <div class="legend-item"> <div class="legend-dot" style="background-color: #ff9800;"></div> Unique Clicks </div> </div> </div> </div> </div> </div> </div> <div> <h1>View Campaign Reports</h1> </div> </main> </div> </div> <script> document.addEventListener('DOMContentLoaded', function() { const deliveries = <?= $campaignData['deliveries'] ?>; const bounces = <?= $campaignData['bounces'] ?>; const unique_opens = <?= $campaignData['unique_opens'] ?>; const unique_clicks = <?= $campaignData['unique_clicks'] ?>; // Pie Chart const deliveriesBouncesChart = new Chart(document.getElementById('deliveriesBouncesChart'), { type: 'pie', data: { labels: ['Delivered', 'Bounced', 'Unique Opens', 'Unique Clicks'], datasets: [{ data: [deliveries, bounces, unique_opens, unique_clicks], backgroundColor: ['#4caf50', '#f44336', '#3f51b5', '#ff9800'] }] }, options: { plugins: { datalabels: { display: true, color: '#fff', formatter: (value) => value, font: { weight: 'bold' } } }, title: { display: true, text: 'Deliveries vs Bounces vs Unique Opens vs Unique Clicks' }, responsive: true, maintainAspectRatio: false, }, plugins: [ChartDataLabels] }); // Horizontal Bar Chart const horizontalBarChart = new Chart(document.getElementById('horizontalBarChart'), { type: 'horizontalBar', data: { labels: ['Delivered', 'Bounces', 'Unique Opens', 'Unique Clicks'], datasets: [{ label: 'Count', data: [deliveries, bounces, unique_opens, unique_clicks], backgroundColor: ['#4caf50', '#f44336', '#3f51b5', '#ff9800'], borderWidth: 1, barThickness: 20 }] }, options: { plugins: { datalabels: { display: true, color: '#fff', formatter: (value) => value, font: { weight: 'bold' } } }, title: { display: true, text: 'Campaign Statistics' }, scales: { xAxes: [{ ticks: { beginAtZero: true } }] }, responsive: true, maintainAspectRatio: false, tooltips: { enabled: true, callbacks: { label: function(tooltipItem) { return tooltipItem.xLabel; } } } }, plugins: [ChartDataLabels] }); }); function downloadPageImage() { const content = document.getElementById('specificContent'); // Use the ID of the section you want to capture html2canvas(content).then(function(canvas) { const link = document.createElement('a'); link.href = canvas.toDataURL('image/png'); link.download = 'Campaign_Details_Page.png'; link.click(); }); } function sendSelectedImage() { const email = document.getElementById('emailInput').value; const fileInput = document.getElementById('imageUpload'); const file = fileInput.files[0]; if (!email || !file) { alert("Please provide both an email address and select an image."); return; } const formData = new FormData(); formData.append('email', email); formData.append('image', file); fetch('send_email_campaignGraph.php', { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { alert('Email sent successfully!'); } else { alert('Failed to send email.'); } }); } </script> <?php $queries = [ "deliveries" => [ "query" => " SELECT d.email, COUNT(*) AS count FROM deliveries d INNER JOIN messages m ON m.message_id = d.message_id WHERE m.campaign_id = ? GROUP BY d.email", "heading" => "Delivery Report", "column" => "email" ], "bounces" => [ "query" => " SELECT b.email, COUNT(*) AS count FROM bounces b INNER JOIN messages m ON m.message_id = b.message_id WHERE m.campaign_id = ? GROUP BY b.email", "heading" => "Bounce Report", "column" => "email" ], "opens" => [ "query" => " SELECT o.to_email AS email, COUNT(*) AS count FROM email_opens o INNER JOIN messages m ON m.message_id = o.message_id WHERE m.campaign_id = ? GROUP BY o.to_email", "heading" => "Email Open Report", "column" => "email" ], "not opened" => [ "query" => " SELECT d.email, COUNT(*) AS not_opened_count FROM deliveries d INNER JOIN messages m ON m.message_id = d.message_id LEFT JOIN email_opens o ON o.to_email = d.email AND o.message_id = m.message_id WHERE m.campaign_id = ? AND o.to_email IS NULL GROUP BY d.email", "heading" => "Not Opened Email Report", // Added 'heading' "column" => "email" // Added 'column' ], "clicks" => [ "query" => " SELECT c.to_email AS email, COUNT(*) AS count FROM email_clicks c INNER JOIN messages m ON m.message_id = c.message_id WHERE m.campaign_id = ? GROUP BY c.to_email", "heading" => "Email Click Report", "column" => "email" ] ]; // Iterate through the queries and display results foreach ($queries as $key => $data) { $stmt = $conn->prepare($data['query']); $stmt->bind_param("i", $campaignId); $stmt->execute(); $result = $stmt->get_result(); // Display the heading with a "Download" button echo "<h2>" . $data['heading'] . " <a href='download_report.php?type=$key&campaignId=$campaignId' class='btn-download'>Download</a></h2>"; // Check if data exists if ($result->num_rows > 0) { echo "<table border='1' cellpadding='5' cellspacing='0'>"; echo "<tr><th>Email</th><th>Count</th></tr>"; while ($row = $result->fetch_assoc()) { echo "<tr>"; echo "<td>" . htmlspecialchars($row[$data['column']]) . "</td>"; // Adjust the column name for the 'not opened' report if ($key == 'not opened') { echo "<td>" . htmlspecialchars($row['not_opened_count']) . "</td>"; // Use 'not_opened_count' for the 'not opened' report } else { echo "<td>" . htmlspecialchars($row['count']) . "</td>"; // Use 'count' for other reports } echo "</tr>"; } echo "</table>"; } else { echo "<p>No data found for " . strtolower($data['heading']) . ".</p>"; } $stmt->close(); } ?> <?php include "footer.php"; ?> </body> </html>