OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
3-31-025chanakya
/
Xpress
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/31/2025 06:36:42 AM
rwxr-xr-x
📄
.browserslistrc
208 bytes
03/26/2025 04:06:47 AM
rw-r--r--
📄
.gitignore
42 bytes
03/26/2025 04:06:47 AM
rw-r--r--
📄
.htaccess
803 bytes
03/26/2025 04:06:47 AM
rw-r--r--
📄
.htaccess.swp
12 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
.travis.yml
199 bytes
03/26/2025 04:06:47 AM
rw-r--r--
📄
09-01-25navbar.php
30.59 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
15-02-25viewList.php
14.86 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
17-02-25newCompaign.php
12.43 KB
03/26/2025 04:06:47 AM
rw-r--r--
📁
NLEditor
-
03/26/2025 04:21:24 AM
rwxr-xr-x
📄
addList.php
6.06 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
adi_deliveryViewList.php
11.13 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
aditya_choose.php
6 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
aditya_choose_template.php
7.52 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
aditya_viewCampaign.php
24.73 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
arvind_choose_templates.php
10.83 KB
03/26/2025 04:06:47 AM
rw-r--r--
📁
assets
-
03/26/2025 04:20:38 AM
rwxr-xr-x
📄
back_choose_template.php
7.52 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
blacklist.php
13.06 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
bounceViewList.php
14.63 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
bounce_handler.php
5.05 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
checkNotificationTopics.php
5.11 KB
03/26/2025 04:06:47 AM
rw-r--r--
📁
check_identity
-
03/26/2025 04:16:12 AM
rwxr-xr-x
📄
checknotif.php
1020 bytes
03/26/2025 04:06:47 AM
rw-r--r--
📄
choose_template.php
6.74 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
clickViewList.php
13.01 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
click_handler.php
1.75 KB
03/26/2025 04:06:47 AM
rw-r--r--
📄
complaintsViewList.php
8.41 KB
03/26/2025 04:06:48 AM
rw-r--r--
📄
complaints_handler.php
2.89 KB
03/26/2025 04:06:48 AM
rw-r--r--
📄
composer.json
200 bytes
03/26/2025 04:06:48 AM
rw-r--r--
📄
composer.lock
39.12 KB
03/26/2025 04:06:48 AM
rw-r--r--
📄
createList.php
19.13 KB
03/26/2025 04:06:48 AM
rw-r--r--
📁
credentials
-
03/26/2025 04:16:13 AM
rwxr-xr-x
📄
csv.php
12.33 KB
03/26/2025 04:06:48 AM
rw-r--r--
📁
data
-
03/26/2025 04:21:24 AM
rwxr-xr-x
📄
db.php
991 bytes
03/26/2025 04:06:48 AM
rw-r--r--
📄
deleteCampaign.php
966 bytes
03/26/2025 04:06:48 AM
rw-r--r--
📄
deleteTemplate.php
1.55 KB
03/26/2025 04:06:48 AM
rw-r--r--
📄
delete_list.php
959 bytes
03/26/2025 04:06:48 AM
rw-r--r--
📄
delete_users.php
435 bytes
03/26/2025 04:06:48 AM
rw-r--r--
📄
deliveryViewList.php
12.9 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
delivery_handler.php
3.25 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
download_Complaints.php
1.16 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
download_bounces.php
1.18 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
download_clicked.php
1.23 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
download_delivered.php
1.12 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
download_open.php
1.22 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
download_report.php
3.33 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
download_unique_open.php
1.6 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
duplicate_campaign.php
1.67 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
edit_campaign.php
1.45 KB
03/26/2025 04:06:49 AM
rw-r--r--
📄
edit_list.php
11.69 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
feedback.php
1.71 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
fetch_template.php
493 bytes
03/26/2025 04:06:50 AM
rw-r--r--
📄
footer.php
1.35 KB
03/26/2025 04:06:50 AM
rw-r--r--
📁
grfx
-
03/26/2025 04:16:13 AM
rwxr-xr-x
📄
himanshu_index.php
6.58 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
himanshu_newCompaign.php
11.25 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
housekeeping.php
24.85 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
index.php
9.9 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
insert_list.php
2.64 KB
03/26/2025 04:06:50 AM
rw-r--r--
📁
js
-
03/26/2025 04:16:13 AM
rwxr-xr-x
📄
load.php
159 bytes
03/26/2025 04:06:50 AM
rw-r--r--
📁
log
-
03/26/2025 04:16:25 AM
rwxr-xr-x
📄
main.css
1.3 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
navbar.php
22.54 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
navbar_menu.php
1.94 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
newCompaign.php
16.25 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
obc_cards.php
7.58 KB
03/26/2025 04:06:50 AM
rw-r--r--
📄
openViewList.php
14.4 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
open_handler.php
1.75 KB
03/26/2025 04:06:51 AM
rw-r--r--
📁
process
-
03/26/2025 04:16:33 AM
rwxr-xr-x
📄
process_emails.php
12.53 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
real-recipients.csv
39.48 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
resubscribe.php
6.41 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
sample.csv
55 bytes
03/26/2025 04:06:51 AM
rw-r--r--
📄
save.php
252 bytes
03/26/2025 04:06:51 AM
rw-r--r--
📄
save_campaign.php
612 bytes
03/26/2025 04:06:51 AM
rw-r--r--
📄
saved_content.html
6.48 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
send_email.php
987 bytes
03/26/2025 04:06:51 AM
rw-r--r--
📄
send_email_campaignGraph.php
2.24 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
sendgrid.php
3.62 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
showListMembers.php
11.44 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
showcase.php
7.79 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
sidebar.php
0 bytes
03/26/2025 04:06:51 AM
rw-r--r--
📄
sns_subscribe.php
5.25 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
submit_form.php
2.48 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
template_index.php
10.08 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
test-mail.csv
337 bytes
03/26/2025 04:06:51 AM
rw-r--r--
📄
test.php
969 bytes
03/26/2025 04:06:51 AM
rw-r--r--
📄
test_choose_template.php
6.51 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
test_process_emails.php
1.91 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
unsubscribe.php
6.87 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
upload_image.php
606 bytes
03/26/2025 04:06:51 AM
rw-r--r--
📁
uploads
-
03/26/2025 04:16:39 AM
rwxr-xr-x
📁
vendor
-
03/26/2025 04:21:35 AM
rwxr-xr-x
📄
verify.html
486 bytes
03/26/2025 04:06:51 AM
rw-r--r--
📄
verify.php
2.54 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
verify_email.php
5.03 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
viewCampaign.php
26.94 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
viewList.php
17.65 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
xpress_handler.php
10.51 KB
03/26/2025 04:06:51 AM
rw-r--r--
📄
znewCompaign.php
10.52 KB
03/26/2025 04:06:52 AM
rw-r--r--
📄
zunsubscribe.php
5.82 KB
03/26/2025 04:06:52 AM
rw-r--r--
📄
zzindex.php
6.8 KB
03/26/2025 04:06:52 AM
rw-r--r--
📄
zzzzindex.php
6.68 KB
03/26/2025 04:06:52 AM
rw-r--r--
📄
zzzzzindex.php
55.73 KB
03/26/2025 04:06:52 AM
rw-r--r--
Editing: viewCampaign.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 = ?", 'not_open' => "SELECT count(*) AS 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 " ]; 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="../assets/js/jquery-3.6.0.min.js"></script> <script src="../assets/js/jquery-3.6.0.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="../assets/css/all.min.6.6.css"> <link rel="stylesheet" href="../assets/css/all.min.5.15.css"> <link rel="stylesheet" href="../assets/css/all.min.5.15.3.css"> <link rel="stylesheet" href="../assets/css/all.min.5.15.css"> <link rel="stylesheet" href="../assets/css/bootstrap.min.4.5.0.css" /> <link rel="stylesheet" href="../assets/css/animate.min.4.0.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" /> <link rel="stylesheet" href="../assets/css/styles.css"> <link rel="stylesheet" href="main.css"> <script src="../assets/js/jquery-3.6.0.min.js"></script> <script src="../assets/js/jquery-3.5.1.min.js" ></script> <script src="../assets/js/bootstrap.min.4.5.js" ></script> <script src="../assets/js/Chart.min.2.8.js" crossorigin="anonymous"></script> <script src="https://cdn.tiny.cloud/1/u5oz235qw5jiqww4udm90ocp9zg2rncblqo2ch0ym3twjgyt/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script> <script src="../assets/js/zf-widget.js"></script> <script src="../inc/jquery.magnific-popup.min.js"></script> <link href="../assets/css/bootstrap-icons.min.1.10.css" rel="stylesheet"> <script src="../inc/common.js"></script> <script type="text/javascript"> </script> <script src="../assets/js/Chart.min.2.8.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="../assets/js/Chart.min.2.8.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: left; 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; color: black; } table, th, td { border: 1px solid #ddd; } th, td { padding: 10px; text-align: left; } th { background-color: #f2f2f2; font-weight: bold; } td { background-color: #fafafa; } 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 { display: inline-flex; flex-direction: row; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-content: center; justify-content: space-evenly; } .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> <style> .sideWithMainContainer { display: flex; flex-direction: row; gap: 10px; overflow-x: hidden; } .sideMaincontent { height: 100vh; overflow-y: scroll; padding: 30px 0; } @media (min-width: 768px) { .col-md-2 { padding: 0px !important; } } @media (max-width: 768px) { .col-md-2 { display: none !important; } } .panelContent { height: 80% !important; overflow-y: auto !important; } main{ padding-bottom: 40px; } </style> <link href="../assets/css/bootstrap-icons.min.1.10.css" rel="stylesheet"> </head> <body class="sb-nav-fixed"> <?php include "assets/php/social_navbar.php"; ?> <div class="xpressMainConatiner" style="display: flex; flex-direction:column"> <div class="sideWithMainContainer"> <div class="col-md-2"> <? include 'assets/php/sidebar.php' ?> </div> <div id="layoutSidenav" class="col-sm-12 col-md-10 sideMaincontent"> <? include 'navbar_menu.php' ?> <div id="layoutSidenav_content"> <main> <div id="panelContent" class="container-fluid"> <div class="container mt-5"> <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" style="width: 400px; height: 400px;"></canvas> </div> <!-- Bar Chart --> <div class="chart"> <canvas id="horizontalBarChart" style="height: 40vh; display: block; width: 95vw;"></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> Not Open </div> <div class="legend-item"> <div class="legend-dot" style="background-color: #ff9800;"></div> Unique Clicks </div> </div> </div> </div> </div> <br><br><br> <div class="mt-4"> <h4>View Campaign Reports</h4> <?php $queries = [ "deliveries" => [ "query" => "SELECT d.email 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 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", "column" => "email" ], "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(); if ($result->num_rows > 0) { ?> <table border='1' cellpadding='5' cellspacing='0'> <tr> <th colspan="2"><?= $data['heading'] ?> <a href="download_report.php?type=<?= $key; ?>&campaignId=<?= $campaignId; ?>" class="btn-download">Download</a> </th> </tr> <!-- Adjust table headers based on the report type --> <tr> <th>Email</th> <? if ($key === "opens" || $key === "clicks" || $key === "bounces") { ?> <th>Count</th> <? } ?> </tr> <? while ($row = $result->fetch_assoc()) { ?> <tr> <td><?= htmlspecialchars($row[$data['column']]) ?></td> <!-- Show count only for "opens" and "clicks" --> <? if ($key === "opens" || $key === "clicks" || $key === "bounces") { ?> <td><?= htmlspecialchars($row['count']) ?></td> <? } ?> </tr> <? } ?> </table> <? } else { ?> <table border='1' cellpadding='5' cellspacing='0'> <tr> <th colspan='2'><?= $data['heading'] ?></th> </tr> <tr> <th colspan='2'> <p>No data found for <?= strtolower($data['heading']) ?></p> </th> </tr> </table> <? } $stmt->close(); } ?> </div> <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> </div> </main> </div> </div> </div> <?php include 'footer.php'; ?> <?php include '../assets/php/bottom_navbar.php'; ?> </div> <script> const canvas = document.getElementById('deliveriesBouncesChart'); canvas.style.width = '300px'; // Width in pixels canvas.style.height = '300px'; // Height in pixels document.addEventListener('DOMContentLoaded', function() { const deliveries = <?= $campaignData['deliveries'] ?>; const bounces = <?= $campaignData['bounces'] ?>; const unique_opens = <?= $campaignData['unique_opens'] ?>; const unique_clicks = <?= $campaignData['unique_clicks'] ?>; const unique_not_open = <?= $campaignData['not_open'] ?>; // Pie Chart const deliveriesBouncesChart = new Chart(document.getElementById('deliveriesBouncesChart'), { type: 'pie', data: { labels: ['Delivered', 'Bounced', 'Unique Opens', 'Not Opened', 'Unique Clicks'], datasets: [{ data: [deliveries, bounces, unique_opens, unique_not_open, unique_clicks], backgroundColor: ['#4caf50', '#f44336', '#3f51b5', '#3f5140', '#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 Not Opened 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', 'Not Opened', 'Unique Clicks'], datasets: [{ label: 'Count', data: [deliveries, bounces, unique_opens, unique_not_open, unique_clicks], backgroundColor: ['#4caf50', '#f44336', '#3f51b5', '#3f5140', '#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> </body> </html>