403Webshell
Server IP : 213.255.246.8  /  Your IP : 216.73.217.138
Web Server : Apache
System : Linux dublin.stapolin.com 5.14.0-362.18.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jan 29 07:05:48 EST 2024 x86_64
User : stapolin ( 1019)
PHP Version : 8.4.24
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/stapolin/public_html/tracking.stapolin.com/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/stapolin/public_html/tracking.stapolin.com/admin/devices.php
<?php

declare(strict_types=1);

require_once __DIR__ . '/../includes/bootstrap.php';
$currentUser = require_login();
$pageTitle = 'Devices';
[$fromUtc, $toUtc, $fromDate, $toDate] = report_date_range();
[$websiteSql, $websiteTypes, $websiteParams] = selected_website_sql('s');

$deviceRows = db_fetch_all(
    'SELECT s.device_category AS label, COUNT(*) AS sessions, COUNT(DISTINCT s.visitor_id) AS visitors, SUM(s.page_views) AS page_views
     FROM sessions s
     WHERE s.started_at BETWEEN ? AND ?' . $websiteSql . '
     GROUP BY s.device_category
     ORDER BY sessions DESC',
    'ss' . $websiteTypes,
    array_merge([$fromUtc, $toUtc], $websiteParams)
);

$browserRows = db_fetch_all(
    'SELECT COALESCE(NULLIF(s.browser, ""), "Unknown") AS label, COUNT(*) AS sessions, COUNT(DISTINCT s.visitor_id) AS visitors, SUM(s.page_views) AS page_views
     FROM sessions s
     WHERE s.started_at BETWEEN ? AND ?' . $websiteSql . '
     GROUP BY label
     ORDER BY sessions DESC
     LIMIT 50',
    'ss' . $websiteTypes,
    array_merge([$fromUtc, $toUtc], $websiteParams)
);

$osRows = db_fetch_all(
    'SELECT COALESCE(NULLIF(s.operating_system, ""), "Unknown") AS label, COUNT(*) AS sessions, COUNT(DISTINCT s.visitor_id) AS visitors, SUM(s.page_views) AS page_views
     FROM sessions s
     WHERE s.started_at BETWEEN ? AND ?' . $websiteSql . '
     GROUP BY label
     ORDER BY sessions DESC
     LIMIT 50',
    'ss' . $websiteTypes,
    array_merge([$fromUtc, $toUtc], $websiteParams)
);

$deviceLabels = array_map(static fn (array $row): string => ucfirst((string) $row['label']), $deviceRows);
$deviceValues = array_map(static fn (array $row): int => (int) $row['sessions'], $deviceRows);

function render_breakdown_table(string $title, array $rows): void
{
    ?>
    <div class="card">
        <div class="card-header bg-white"><?= e($title) ?></div>
        <div class="table-responsive">
            <table class="table table-hover mb-0">
                <thead><tr><th>Name</th><th class="text-end">Sessions</th><th class="text-end">Visitors</th><th class="text-end">Page views</th></tr></thead>
                <tbody>
                <?php if ($rows === []): ?><tr><td colspan="4" class="text-center text-muted py-5">No data for this range.</td></tr><?php endif; ?>
                <?php foreach ($rows as $row): ?>
                    <tr>
                        <td><?= e(ucfirst((string) $row['label'])) ?></td>
                        <td class="text-end"><?= (int) $row['sessions'] ?></td>
                        <td class="text-end"><?= (int) $row['visitors'] ?></td>
                        <td class="text-end"><?= (int) $row['page_views'] ?></td>
                    </tr>
                <?php endforeach; ?>
                </tbody>
            </table>
        </div>
    </div>
    <?php
}

require APP_ROOT . '/templates/admin_header.php';
?>
<h1 class="h3 mb-3">Devices</h1>
<?= report_filter_form('admin/devices.php', $fromDate, $toDate) ?>

<div class="row g-4 mb-4">
    <section class="col-lg-5">
        <div class="card">
            <div class="card-header bg-white">Device categories</div>
            <div class="card-body chart-panel">
                <canvas data-chart="doughnut" data-labels="<?= e(json_encode($deviceLabels, JSON_THROW_ON_ERROR)) ?>" data-values="<?= e(json_encode($deviceValues, JSON_THROW_ON_ERROR)) ?>"></canvas>
            </div>
        </div>
    </section>
    <section class="col-lg-7">
        <?php render_breakdown_table('Device categories', $deviceRows); ?>
    </section>
</div>

<div class="row g-4">
    <section class="col-lg-6"><?php render_breakdown_table('Browsers', $browserRows); ?></section>
    <section class="col-lg-6"><?php render_breakdown_table('Operating systems', $osRows); ?></section>
</div>
<?php require APP_ROOT . '/templates/admin_footer.php'; ?>

Youez - 2016 - github.com/yon3zu
LinuXploit