OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
process
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
11/28/2024 11:03:35 AM
rwxrwxr-x
📄
chk.logged.in.php
1.16 KB
01/10/2021 12:30:27 PM
rw-r--r--
📄
chk.login.php
1.31 KB
02/10/2022 03:03:00 PM
rw-r--r--
📄
get.section.account.php
15.11 KB
12/28/2024 08:09:41 AM
rw-r--r--
📄
get.section.analytics.php
28.73 KB
03/02/2025 09:40:12 AM
rw-r--r--
📄
get.section.collection.php
69.19 KB
03/04/2025 05:15:01 AM
rw-r--r--
📄
get.section.community.php
7.71 KB
09/09/2024 09:46:26 AM
rw-r--r--
📄
get.section.create.php
22.41 KB
05/22/2024 11:08:28 AM
rw-r--r--
📄
get.section.curated.php
33.87 KB
03/02/2025 10:52:06 AM
rw-r--r--
📄
get.section.dashboard.php
3.31 KB
02/10/2022 02:58:26 PM
rw-r--r--
📄
get.section.feed.php
6.87 KB
03/09/2023 05:28:34 AM
rw-r--r--
📄
get.section.genai.php
9.87 KB
08/21/2024 07:23:47 AM
rw-r--r--
📄
get.section.genaicreative.php
10.55 KB
08/21/2024 07:23:45 AM
rw-r--r--
📄
get.section.general.php
9.31 KB
08/22/2023 09:34:25 AM
rw-r--r--
📄
get.section.newsletter.php
18.97 KB
08/22/2024 06:42:01 AM
rw-r--r--
📄
get.section.request.article.php
13.34 KB
03/02/2025 06:07:24 AM
rw-r--r--
📄
get.section.settings.php
42.64 KB
03/02/2025 10:13:44 AM
rw-r--r--
📄
get.section.team.php
6.73 KB
05/23/2024 04:45:44 AM
rw-r--r--
📄
get.section.utils.php
4.1 KB
06/26/2021 06:06:51 AM
rw-r--r--
📄
logout.php
428 bytes
08/16/2020 11:22:29 AM
rw-r--r--
📄
sendgrid.php
3.62 KB
03/09/2021 04:01:36 AM
rw-r--r--
📄
upload.php
2.4 KB
08/22/2020 01:33:43 PM
rw-r--r--
📄
zget.section.analytics.php
11.45 KB
03/02/2025 06:25:31 AM
rw-r--r--
Editing: get.section.analytics.php
Close
<? // Cream: Analytics require_once '../inc/validate.logged.php'; require_once '../inc/config.php'; $act = ''; if (!empty($_POST)) $act = isset($_POST["act"]) ? $_POST["act"] : ''; // Show Blast Details if ($act == 'showBlastDetails') { $blastId = isset($_POST['id']) ? $_POST['id'] : ''; $sql = "SELECT send_grid_key FROM user WHERE id=$gUserId"; $result = mysqli_query($db, $sql); $row = mysqli_fetch_assoc($result); $userSendGridKey = $row['send_grid_key']; $apiURL = "https://api.sendgrid.com/v3/marketing/stats/singlesends/$blastId?group_by=ab_variation&aggregated_by=total"; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $apiURL, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HTTPHEADER => array( "authorization: Bearer $userSendGridKey" ), )); $response = curl_exec($curl); curl_close($curl); $arrStats = json_decode($response, true); $arrStatsClicks = $arrStats['results'][0]['stats']['clicks']; $arrStatsUniqueClicks = $arrStats['results'][0]['stats']['unique_clicks']; $arrStatsDelivered = $arrStats['results'][0]['stats']['delivered']; $arrStatsInvalidEmails = $arrStats['results'][0]['stats']['invalid_emails']; $arrStatsOpens = $arrStats['results'][0]['stats']['opens']; $arrStatsUniqueOpens = $arrStats['results'][0]['stats']['unique_opens']; $arrStatsUnsubscribes = $arrStats['results'][0]['stats']['unsubscribes']; ?> <div class="popup" style="max-width:600px"> <div class="widget"> <div class="card"> <div class="card-header bg-dark"> <h5 class="mb-0 text-light">Newsletter Details</h5> </div> </div> <div id="widget_B" style="padding:15px 25px; max-height:calc(100vh - 200px);overflow-y:auto;"> <table class="table table-striped"> <tr> <td>Delivered</td> <td><?= $arrStatsDelivered ?></td> </tr> <tr> <td>Unique Opens</td> <td><?= $arrStatsUniqueOpens ?></td> </tr> <tr> <td>Unique Clicks</td> <td><?= $arrStatsUniqueClicks ?></td> </tr> <tr> <td>Unsubscribes</td> <td><?= $arrStatsUnsubscribes ?></td> </tr> </table> </div> </div> </div> <? } // Show Article Details if ($act == 'showArticleDetails') { $postId = isset($_POST['id']) ? $_POST['id'] : ''; ?> <div class="popup" style="max-width:600px"> <div class="widget"> <div class="card"> <div class="card-header bg-dark"> <h5 class="mb-0 text-light">Article Details</h5> </div> </div> <div id="widget_B" style="padding:15px 25px; max-height:calc(100vh - 200px);overflow-y:auto;"> <? if ($gUserPlan == 0) { echo '<div class="alert alert-success" role="alert">This feature is only available in <b>Pro</b> plan! Go to My Account to upgrade.</div>'; } else { ?> <table class="table table-striped"> <thead> <tr> <th>Country</th> <th class="text-center">Total Views</th> <th>View Breakdown</th> </tr> </thead> <tbody> <? $sql = "SELECT count(article_id) AS totalVisits,visit_country FROM metrics WHERE article_id=$postId GROUP BY visit_country ORDER BY visit_country"; $result = mysqli_query($db, $sql); while ($row = mysqli_fetch_assoc($result)) { $visitCountry = $row['visit_country']; $visitCountryCount = $row['totalVisits']; ?> <tr> <td><?= $visitCountry ?></td> <td align="center"><?= $visitCountryCount ?></td> <td> <? $sql = "SELECT count(article_id) AS totalVisits,visit_city FROM metrics WHERE article_id=$postId AND visit_country='$visitCountry' GROUP BY visit_city ORDER BY visit_city"; $resultInner = mysqli_query($db, $sql); while ($rowInner = mysqli_fetch_assoc($resultInner)) { $visitCity = $rowInner['visit_city']; $visitCityCount = $rowInner['totalVisits']; if ($visitCity == '') $visitCity = 'Unknown'; ?> <?= $visitCity ?> - <?= $visitCityCount ?><br> <? } ?> </td> </tr> <? } ?> </tbody> </table> <? } ?> </div> </div> </div> <? } // Show Article Leads if ($act == 'showArticleLeads') { $postId = isset($_POST['id']) ? $_POST['id'] : ''; ?> <div class="popup" style="max-width:900px"> <div class="widget"> <div class="card"> <div class="card-header bg-dark"> <h5 class="mb-0 text-light">Article Lead Details</h5> </div> </div> <div id="widget_B" style="padding:15px 25px; max-height:calc(100vh - 200px);overflow-y:auto;"> <table class="table table-striped"> <thead> <tr> <th width="20">#</th> <th>Name</th> <th>Company</th> <th>Email</th> <th>Mobile</th> <th>Date</th> </tr> </thead> <tbody> <? $sql = "SELECT * FROM user_collection_lead WHERE article_id=$postId ORDER BY date_created DESC"; $result = mysqli_query($db, $sql); $i = 1; while ($row = mysqli_fetch_assoc($result)) { $leadName = $row['full_name']; $leadCompany = $row['company']; $leadEmail = $row['email']; $leadMobile = $row['mobile']; $leadDate = $row['date_created']; $leadDate = date('M d, Y', strtotime($leadDate)); ?> <tr> <td><?= $i ?>.</td> <td><?= $leadName ?></td> <td><?= $leadCompany ?></td> <td><?= $leadEmail ?></td> <td><?= $leadMobile ?></td> <td><?= $leadDate ?></td> </tr> <? $i += 1; } ?> </tbody> </table> </div> </div> </div> <? } ?> <? if ($act == '') { ?> <style> .card-container { display: flex; gap: 20px; flex-wrap: wrap; /* justify-content: space-between; */ } .card { background: #ffffff; padding: 20px; width: 250px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); text-align: center; transition: transform 0.3s; } .card:hover { transform: translateY(-5px); } .card h2 { font-size: 20px; color: #555; margin-bottom: 10px; } .card .count { font-size: 30px; font-weight: bold; color: #333; } .card-1 { border-left: 5px solid #3498db; } .card-2 { border-left: 5px solid #2ecc71; } .card-3 { border-left: 5px solid #e74c3c; } /* Mobile responsiveness */ @media (max-width: 768px) { .card-container { gap: 15px; /* Decrease gap between cards */ justify-content: center; /* Center the cards */ } .card { width: 100%; /* Make each card full width on smaller screens */ max-width: 320px; /* Set a maximum width for the cards */ margin-bottom: 15px; /* Add some spacing between cards */ } .card h2 { font-size: 18px; /* Slightly smaller font size for headings */ } .card .count { font-size: 25px; /* Slightly smaller font size for counts */ } } @media (max-width: 480px) { .card-container { gap: 10px; /* Decrease gap even further */ } .card h2 { font-size: 16px; /* Even smaller font size for headings */ } .card .count { font-size: 22px; /* Even smaller font size for counts */ } } </style> <ol class="breadcrumb my-3"> <li class="breadcrumb-item"> <h4 class="m-0">Analytics</h4> </li> </ol> <?php function checkQuery($db, $query) { $result = $db->query($query); if (!$result) { die("Query Failed: " . $db->error . " - SQL: " . $query); } return $result; } // Ensure database connection is working if (!$db) { die("Database connection failed: " . mysqli_connect_error()); } $articleQuery = "SELECT COUNT(*) AS total_articles FROM user_collection where user_id = $gUserId"; $articleResult = checkQuery($db, $articleQuery); $totalArticles = ($articleResult->num_rows > 0) ? $articleResult->fetch_assoc()['total_articles'] : 0; $gUserId = isset($gUserId) ? (int) $gUserId : 0; $feedQuery = "SELECT COUNT(*) AS total_feeds from user_feeds WHERE user_id = $gUserId"; $feedResult = checkQuery($db, $feedQuery); $totalFeeds = ($feedResult->num_rows > 0) ? $feedResult->fetch_assoc()['total_feeds'] : 0; // Fetch total visits count from 'metrics' $visitQuery = "SELECT COUNT(A.article_id) AS totalVisits FROM metrics A INNER JOIN user_collection B ON A.article_id = B.id AND B.user_id = 391;"; $visitResult = checkQuery($db, $visitQuery); $totalVisits = ($visitResult->num_rows > 0) ? $visitResult->fetch_assoc()['totalVisits'] : 0; ?> <div class="card-container"> <div class="card card-1"> <h2>Total Articles</h2> <div class="count"><?php echo $totalArticles; ?></div> </div> <div class="card card-2"> <h2>Total Feeds</h2> <div class="count"><?php echo $totalFeeds; ?></div> </div> <div class="card card-3"> <h2>Total Visits</h2> <div class="count"><?php echo number_format($totalVisits); ?></div> </div> </div> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js@4.3.0"></script> <ol class="breadcrumb my-3"> <li class="breadcrumb-item"> <h4 class="m-0">Month-wise Analytics</h4> </li> </ol> <?php // Connect to the database (make sure your connection is established) // Query to fetch monthly visit counts $query = " SELECT DATE_FORMAT(A.date_visited, '%Y-%m') AS month, COUNT(A.article_id) AS totalVisits FROM metrics A INNER JOIN user_collection B ON A.article_id = B.id AND B.user_id = $gUserId WHERE A.date_visited >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR) GROUP BY DATE_FORMAT(A.date_visited, '%Y-%m') ORDER BY month ASC; "; // Execute the query $result = $db->query($query); // Initialize arrays to hold the data for the chart $labels = []; $data = []; // Process the query result while ($row = $result->fetch_assoc()) { $labels[] = date("M Y", strtotime($row['month'] . "-01")); // Format as "Jan 2024" $data[] = $row['totalVisits']; } ?> <!-- Chart.js HTML and Script --> <div style="width: 100%; margin: 0 auto;"> <canvas id="visitsChart"></canvas> </div> <script> // Pass data from PHP to JavaScript const labels = <?php echo json_encode($labels); ?>; const data = <?php echo json_encode($data); ?>; // Create the Chart.js line chart const ctx = document.getElementById('visitsChart').getContext('2d'); new Chart(ctx, { type: 'line', data: { labels: labels, // X-axis labels (Months) datasets: [{ label: 'Total Visits', data: data, // Y-axis data (Total Visits per Month) borderColor: 'rgb(54, 162, 235)', backgroundColor: 'rgba(54, 162, 235, 0.2)', borderWidth: 3, fill: true, tension: 0.3, pointRadius: 5, pointBackgroundColor: 'rgb(255, 99, 132)' }] }, options: { responsive: true, plugins: { title: { display: true, text: 'Monthly Website Visits', font: { size: 18 } }, legend: { display: true, position: 'top' } }, scales: { y: { beginAtZero: true, title: { display: true, text: 'Number of Visits (Higher is Better)', color: '#333', font: { size: 14, weight: 'bold' } }, ticks: { stepSize: 10 } }, x: { title: { display: true, text: 'Month (Track Your Growth)', color: '#333', font: { size: 14, weight: 'bold' } } } } } }); </script> <br> <br> <style> /* Ensure the tabs are scrollable on smaller screens */ .nav-tabs { display: flex; flex-wrap: nowrap; /* Prevent wrapping of tabs */ overflow-x: auto; /* Allow horizontal scrolling */ -webkit-overflow-scrolling: touch; /* Enable smooth scrolling on iOS */ } .nav-tabs .nav-item { flex-shrink: 0; /* Prevent tabs from shrinking */ } /* Optional: Add some padding and make it look nicer */ .nav-tabs { padding: 10px 0; } /* Adjust tab content for mobile responsiveness */ @media (max-width: 768px) { .nav-tabs { margin-bottom: 10px; /* Add margin below the tabs */ } .nav-tabs .nav-link { padding: 10px 15px; /* Adjust padding for better appearance */ } } </style> <div class="row mb-4"> <div class="col"> <ul class="nav nav-tabs mb-4"> <li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#articles" role="tab">Top Visited Articles</a></li> <li class="nav-item"><a class="nav-link" data-toggle="tab" href="#lead" role="tab">Article Leads</a></li> <li class="nav-item"><a class="nav-link" data-toggle="tab" href="#newsletter" role="tab">Sent Newsletters</a></li> </ul> <div class="tab-content my-3"> <div class="tab-pane fade show active" id="articles" role="tabpanel"> <? $sql = "SELECT B.id,B.title,count(A.article_id) AS totalVisits FROM metrics A INNER JOIN user_collection B ON (A.article_id=B.id AND B.user_id=$gUserId) GROUP BY B.url,B.id ORDER BY totalVisits DESC"; $result = mysqli_query($db, $sql); $numRows = mysqli_num_rows($result); if ($numRows == 0) { echo '<div class="px-3">No articles to show!</div>'; } else { ?> <table class="table table-striped"> <thead> <tr> <th width="20">#</th> <th>Title</th> <th>Views</th> <th></th> </tr> </thead> <tbody> <? $i = 1; while ($row = mysqli_fetch_assoc($result)) { $topArticleId = $row['id']; $topArticleTitle = $row['title']; $topArticleVisit = $row['totalVisits']; ?> <tr> <td><?= $i ?>.</td> <td><a href="https://www.knoblyreader.com/view/<?= $topArticleId ?>/<?= createArticleURL($topArticleTitle) ?>" target="_blank"><?= $topArticleTitle ?></a></td> <td><?= $topArticleVisit ?></td> <td align="right"><a href="#" title="View Details"><i data-id="<?= $topArticleId ?>" class="viewRowA far fa-chart-bar fa-lg text-muted"></i></a></td> </tr> <? $i += 1; } ?> </tbody> </table> <? } ?> </div> <div class="tab-pane fade" id="lead" role="tabpanel"> <? if ($gUserPlan == 0) { echo '<div class="alert alert-success" role="alert">This feature is only available in <b>Pro</b> plan! Go to My Account to upgrade.</div>'; } else { $sql = "SELECT B.id,B.title,count(A.article_id) AS totalLeads FROM user_collection_lead A INNER JOIN user_collection B ON (A.article_id=B.id AND B.user_id=$gUserId) GROUP BY B.url,B.id ORDER BY totalLeads DESC LIMIT 25"; $result = mysqli_query($db, $sql); $numRows = mysqli_num_rows($result); if ($numRows == 0) { echo '<div class="px-3">No article leads to show!</div>'; } else { ?> <table class="table table-striped"> <thead> <tr> <th width="20">#</th> <th>Title</th> <th>Leads</th> <th></th> </tr> </thead> <tbody> <? $i = 1; while ($row = mysqli_fetch_assoc($result)) { $topArticleId = $row['id']; $topArticleTitle = $row['title']; $topArticleLead = $row['totalLeads']; ?> <tr> <td><?= $i ?>.</td> <td><a href="https://www.knoblycream.com/view/<?= $topArticleId ?>/<?= createArticleURL($topArticleTitle) ?>" target="_blank"><?= $topArticleTitle ?></a></td> <td><?= $topArticleLead ?></td> <td align="right"><a href="#" title="View Details"><i data-id="<?= $topArticleId ?>" class="viewRowL far fa-chart-bar fa-lg text-muted"></i></a></td> </tr> <? $i += 1; } ?> </tbody> </table> <? } } ?> </div> <div class="tab-pane fade" id="newsletter" role="tabpanel"> <? if ($gUserPlan == 0) { echo '<div class="alert alert-success" role="alert">This feature is only available in <b>Pro</b> plan! Go to My Account to upgrade.</div>'; } else { $sql = "SELECT A.newsletter_id,A.blast_provider,A.blast_subject,A.blast_id,A.date_created FROM user_blast A INNER JOIN user_newsletter B ON A.newsletter_id=B.id AND B.user_id=$gUserId"; $result = mysqli_query($db, $sql); $numRows = mysqli_num_rows($result); if ($numRows == 0) { echo '<div class="px-3">No newsletters sent!</div>'; } else { ?> <table class="table table-striped"> <thead> <tr> <th width="20">#</th> <th>Provider</th> <th>Subject</th> <th>Date Sent</th> <th></th> </tr> </thead> <tbody> <? $i = 1; while ($row = mysqli_fetch_assoc($result)) { $newsletterId = $row['newsletter_id']; $blastId = $row['blast_id']; $blastProvider = $row['blast_provider']; $blastSubject = $row['blast_subject']; $blastDate = $row['date_created']; $blastDate = date('M d, Y', strtotime($blastDate)); ?> <tr> <td><?= $i ?>.</td> <td><?= $blastProvider ?></td> <td><a href="newsletter.php?id=<?= $newsletterId ?>" target="_blank"><?= $blastSubject ?></a></td> <td><?= $blastDate ?></td> <td align="right"><a href="#" title="View Details"><i data-id="<?= $blastId ?>" class="viewRowN far fa-chart-bar fa-lg text-muted"></i></a></td> </tr> <? $i += 1; } ?> </tbody> </table> <? } } ?> </div> </div> </div> </div> <script type="text/javascript"> $(function() { $('.viewRowA').magnificPopup({ type: 'ajax', closeBtnInside: true, ajax: { settings: { method: 'POST', url: 'process/get.section.analytics.php' } }, callbacks: { elementParse: function(item) { var data = $(item.el[0]).closest('.data'); postData = { act: 'showArticleDetails', id: $(item.el[0]).data('id') } this.st.ajax.settings.data = postData; } } }); $('.viewRowL').magnificPopup({ type: 'ajax', closeBtnInside: true, ajax: { settings: { method: 'POST', url: 'process/get.section.analytics.php' } }, callbacks: { elementParse: function(item) { var data = $(item.el[0]).closest('.data'); postData = { act: 'showArticleLeads', id: $(item.el[0]).data('id') } this.st.ajax.settings.data = postData; } } }); $('.viewRowN').magnificPopup({ type: 'ajax', closeBtnInside: true, ajax: { settings: { method: 'POST', url: 'process/get.section.analytics.php' } }, callbacks: { elementParse: function(item) { var data = $(item.el[0]).closest('.data'); postData = { act: 'showBlastDetails', id: $(item.el[0]).data('id') } this.st.ajax.settings.data = postData; } } }); }); </script> <? } ?>