403Webshell
Server IP : 127.0.0.1  /  Your IP : 192.168.99.1
Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9
System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64
User : Administrator ( 0)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /bpkd_/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /bpkd_/live_absensi.php
<?php
/**
 * Halaman Live Absensi Hari Ini — Versi Card
 * - Card full foto dengan overlay nama, jabatan, jam, status
 * - Badge LIVE di header
 * - Hanya tampil antara jam 07:00 - 15:00 WIB
 */

require_once __DIR__ . '/api/pegawai/api_config.php';
require_once 'includes/config.php';

date_default_timezone_set('Asia/Jakarta');

// ============================================================
// KONFIGURASI JAM OPERASIONAL
// ============================================================
$jam_buka  = 6;
$jam_tutup = 15;

$jam_sekarang   = (int) date('G');
$dalam_jam_operasional = ($jam_sekarang >= $jam_buka && $jam_sekarang < $jam_tutup);
?>
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="utf-8">
<title>Live Presensi Hari Ini</title>
<link rel="shortcut icon" href="favicon.png" type="image/x-icon">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php if ($dalam_jam_operasional): ?>
    <meta http-equiv="refresh" content="30">
<?php endif; ?>
<style>
    * { box-sizing: border-box; margin: 0; padding: 0; }

    body {
        font-family: 'Segoe UI', Arial, sans-serif;
        background: #0f172a;
        color: #e2e8f0;
        min-height: 100vh;
        padding: 20px;
    }

    /* ================= HEADER ================= */
    .header {
        max-width: 1400px;
        margin: 0 auto 26px;
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border: 1px solid #1e293b;
        padding: 18px 26px;
        border-radius: 14px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 12px;
        box-shadow: 0 8px 30px rgba(0,0,0,0.35);
    }
    .header .left {
        display: flex;
        align-items: center;
        gap: 16px;
    }
    .header .title {
        font-size: 22px;
        font-weight: 700;
        letter-spacing: 0.5px;
        color: #f1f5f9;
    }
    .header .title small {
        display: block;
        font-weight: 400;
        font-size: 12px;
        color: #94a3b8;
        margin-top: 3px;
        letter-spacing: 0;
    }

    /* ----- Badge LIVE ----- */
    .live-badge {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        background: #dc2626;
        color: #fff;
        padding: 6px 14px;
        border-radius: 999px;
        font-weight: 700;
        font-size: 13px;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        box-shadow: 0 0 0 0 rgba(220,38,38,0.7);
        animation: pulse 1.8s infinite;
    }
    .live-badge .dot {
        width: 8px;
        height: 8px;
        background: #fff;
        border-radius: 50%;
        animation: blink 1s infinite;
    }
    @keyframes pulse {
        0%   { box-shadow: 0 0 0 0 rgba(220,38,38,0.6); }
        70%  { box-shadow: 0 0 0 14px rgba(220,38,38,0); }
        100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
    }
    @keyframes blink {
        0%, 100% { opacity: 1; }
        50%      { opacity: 0.3; }
    }

    .header .clock {
        text-align: right;
    }
    .header .clock .jam {
        font-size: 28px;
        font-weight: 700;
        font-family: 'Consolas', 'Courier New', monospace;
        letter-spacing: 2px;
        color: #22d3ee;
    }
    .header .clock .tanggal {
        font-size: 12px;
        color: #94a3b8;
        margin-top: 2px;
    }

    /* ================= SUMMARY ================= */
    .summary {
        max-width: 1400px;
        margin: 0 auto 22px;
        display: flex;
        justify-content: center;
        gap: 12px;
        flex-wrap: wrap;
    }
    .summary .box {
        background: #1e293b;
        border: 1px solid #334155;
        padding: 10px 22px;
        border-radius: 10px;
        font-weight: 600;
        font-size: 14px;
        color: #cbd5e1;
    }
    .summary .box span { font-weight: 700; }
    .summary .box.HADIR span { color: #4ade80; }
    .summary .box.IZIN  span { color: #fbbf24; }
    .summary .box.SAKIT span { color: #f87171; }

    /* ================= GRID CARD ================= */
    .grid {
        max-width: 1400px;
        margin: 0 auto;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 18px;
    }

    .card {
        position: relative;
        background: #1e293b;
        border-radius: 14px;
        overflow: hidden;
        box-shadow: 0 6px 20px rgba(0,0,0,0.4);
        transition: transform 0.25s ease, box-shadow 0.25s ease;
        aspect-ratio: 3 / 4;
        display: flex;
        flex-direction: column;
    }
    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 30px rgba(0,0,0,0.55);
    }

    /* ----- Foto full ----- */
    .card .photo-wrap {
        position: absolute;
        inset: 0;
        overflow: hidden;
    }
    .card .photo-wrap img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center top;
        display: block;
        transition: transform 0.4s ease;
    }
    .card:hover .photo-wrap img {
        transform: scale(1.05);
    }

    /* ----- Gradient overlay bawah ----- */
    .card .overlay {
        position: absolute;
        left: 0; right: 0; bottom: 0;
        padding: 46px 14px 14px;
        background: linear-gradient(
            to top,
            rgba(0,0,0,0.92) 0%,
            rgba(0,0,0,0.75) 40%,
            rgba(0,0,0,0.35) 70%,
            rgba(0,0,0,0) 100%
        );
        color: #fff;
        z-index: 2;
    }
    .card .overlay .nama {
        font-size: 15px;
        font-weight: 700;
        line-height: 1.25;
        margin-bottom: 3px;
        text-shadow: 0 1px 3px rgba(0,0,0,0.6);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .card .overlay .jabatan {
        font-size: 11.5px;
        color: #cbd5e1;
        margin-bottom: 8px;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .card .overlay .meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 6px;
        margin-top: 6px;
    }
    .card .overlay .waktu {
        font-family: 'Consolas', 'Courier New', monospace;
        font-size: 15px;
        font-weight: 700;
        color: #22d3ee;
        letter-spacing: 1px;
        text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    }
    .card .overlay .stat {
        display: inline-block;
        padding: 4px 10px;
        border-radius: 999px;
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: 1px;
        text-transform: uppercase;
        color: #fff;
    }
    .stat.HADIR  { background: #16a34a; }
    .stat.IZIN   { background: #d97706; }
    .stat.SAKIT  { background: #dc2626; }
    .stat.CUTI   { background: #2563eb; }
    .stat.DL     { background: #7c3aed; }
    .stat.default{ background: #64748b; }

    /* ----- Badge status pojok atas ----- */
    .card .badge-top {
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 3;
        background: rgba(0,0,0,0.65);
        color: #22d3ee;
        font-size: 10px;
        font-weight: 700;
        padding: 4px 9px;
        border-radius: 6px;
        letter-spacing: 1px;
        backdrop-filter: blur(4px);
    }

    /* ----- Empty state ----- */
    .empty-state {
        grid-column: 1 / -1;
        text-align: center;
        padding: 70px 20px;
        background: #1e293b;
        border: 1px dashed #334155;
        border-radius: 14px;
        color: #94a3b8;
        font-style: italic;
    }

    /* ================= OFF SCREEN ================= */
    .off-screen {
        max-width: 700px;
        margin: 60px auto;
        background: #1e293b;
        border: 1px solid #334155;
        border-radius: 16px;
        padding: 50px 30px;
        text-align: center;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    }
    .off-screen .icon { font-size: 64px; margin-bottom: 10px; }
    .off-screen h1 {
        font-size: 34px;
        color: #f87171;
        letter-spacing: 2px;
        margin-bottom: 8px;
    }
    .off-screen p { color: #94a3b8; font-size: 15px; margin: 6px 0; }
    .off-screen .jam-besar {
        font-size: 46px;
        font-family: 'Consolas', 'Courier New', monospace;
        font-weight: 700;
        color: #22d3ee;
        margin: 20px 0 8px;
        letter-spacing: 3px;
    }
    .off-screen .info-jam {
        background: #0f172a;
        border-left: 4px solid #22d3ee;
        padding: 12px 18px;
        margin: 24px auto 0;
        max-width: 400px;
        text-align: left;
        font-size: 14px;
        color: #cbd5e1;
        border-radius: 8px;
    }

    @media (max-width: 480px) {
        .header .clock .jam { font-size: 22px; }
        .header .title { font-size: 18px; }
        .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    }
</style>
</head>
<body>

<?php
    /**
     * Sensor NIP: ganti 10 karakter pertama dengan '*'
     * Kalau NIP <= 10 karakter, semua disensor.
     */
    function sensor_nip($nip, $prefix = 10)
    {
        $nip = (string) $nip;
        $len = strlen($nip);

        if ($len <= $prefix) {
            return str_repeat('*', $len);
        }

        return str_repeat('*', $prefix) . substr($nip, $prefix);
    }    

?>

<?php if (!$dalam_jam_operasional): ?>

    <!-- =====================================================
         OFF SCREEN
         ===================================================== -->
    <div class="off-screen">
        <div class="icon">🌙</div>
        <h1>OFF</h1>
        <p>Halaman live presensi hanya aktif pada jam sistem.</p>

        <div class="jam-besar" id="jamOff">--:--:--</div>
        <p id="tanggalOff" style="color:#64748b;font-size:13px;"></p>

        <div class="info-jam">
            <strong>Jam tampil:</strong><br>
            Setiap hari, pukul
            <strong>07:00</strong> s.d. <strong>15:00</strong> WIB
        </div>
    </div>

    <script>
        function tickOff() {
            const now = new Date();
            const jam   = String(now.getHours()).padStart(2, '0');
            const menit = String(now.getMinutes()).padStart(2, '0');
            const detik = String(now.getSeconds()).padStart(2, '0');
            document.getElementById('jamOff').textContent = jam + ':' + menit + ':' + detik;

            const hari = ['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu'][now.getDay()];
            const bln  = ['Januari','Februari','Maret','April','Mei','Juni','Juli',
                          'Agustus','September','Oktober','November','Desember'][now.getMonth()];
            document.getElementById('tanggalOff').textContent =
                hari + ', ' + now.getDate() + ' ' + bln + ' ' + now.getFullYear();

            if (now.getHours() >= 6 && now.getHours() < 15) location.reload();
        }
        tickOff();
        setInterval(tickOff, 1000);
    </script>

<?php else:

    // ============================================================
    // AMBIL DATA
    // ============================================================
    try {
        $pdo = new PDO(
            'mysql:host=' . DB_HOST . ';dbname=' . DB_NAME . ';charset=utf8mb4',
            DB_USER,
            DB_PASS,
            [
                PDO::ATTR_ERRMODE            => PDO::ERRMODE_EXCEPTION,
                PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
            ]
        );
    } catch (Exception $e) {
        die('DB Error: ' . $e->getMessage());
    }

    $stmt = $pdo->prepare("
        SELECT nip, namapegawai, jabatan, waktu, foto, stat
        FROM pegawai
        WHERE tgl_hariini = CURDATE()
          AND stat IS NOT NULL
          AND stat <> ''
        ORDER BY id ASC;
    ");
    $stmt->execute();
    $rows = $stmt->fetchAll();

    $totalHadir = 0; $totalIzin = 0; $totalSakit = 0; $totalCuti = 0; $totalWfh = 0;
    foreach ($rows as $r) {
        $s = strtoupper(trim($r['stat']));
        if ($s == 'HADIR' || $s == 'ADA') $totalHadir++;
        elseif ($s === 'IZIN') $totalIzin++;
        elseif ($s === 'SAKIT') $totalSakit++;
        elseif ($s === 'CUTI') $totalCuti++;
        elseif ($s === 'WFH') $totalWfh++;
    }

    // Placeholder foto default (SVG inline, base64-encoded aman)
    $placeholder = 'data:image/svg+xml;utf8,' . rawurlencode(
        '<svg xmlns="http://www.w3.org/2000/svg" width="300" height="400" viewBox="0 0 300 400">' .
        '<rect width="300" height="400" fill="#334155"/>' .
        '<circle cx="150" cy="150" r="60" fill="#64748b"/>' .
        '<path d="M40 400c0-70 50-110 110-110s110 40 110 110z" fill="#64748b"/>' .
        '</svg>'
    );
?>

    <!-- =====================================================
         HEADER + BADGE LIVE
         ===================================================== -->
    <div class="header">
        <div class="left">
            <span class="live-badge"><span class="dot"></span> Live</span>
            <div class="title">
                Profil Kehadiran Hari Ini
                <small>Update terakhir: <?= date('H:i:s') ?> WIB</small>
            </div>
        </div>
        <div class="clock">
            <div class="jam" id="jamHeader">--:--:--</div>
            <div class="tanggal" id="tanggalHeader"></div>
        </div>
    </div>

    <!-- =====================================================
         SUMMARY
         ===================================================== -->
    <div class="summary">
        <div class="box HADIR">Hadir: <span><?= $totalHadir ?></span></div>
        <div class="box IZIN">Izin: <span><?= $totalIzin ?></span></div>
        <div class="box SAKIT">Sakit: <span><?= $totalSakit ?></span></div>
        <div class="box CUTI">Cuti: <span><?= $totalCuti ?></span></div>
        <div class="box HADIR">Wfh: <span><?= $totalWfh ?></span></div>
        <div class="box">Total: <span><?= count($rows) ?></span></div>
    </div>

    <!-- =====================================================
         GRID CARD
         ===================================================== -->
    <div class="grid">
    <?php if (empty($rows)): ?>
        <div class="empty-state">Belum ada absensi hari ini</div>
    <?php else: ?>
        <?php foreach ($rows as $r):
            $stat = strtoupper(trim($r['stat']));
            $cls  = in_array($stat, ['HADIR','IZIN','SAKIT','CUTI','DL','WFH'])
                    ? $stat : 'default';

            $foto = trim((string)$r['foto']);
            $fotoUrl = ($foto === '') ? $placeholder : 'assets/foto/' . rawurlencode($foto);

            $waktu = $r['waktu'] ? date('H:i', strtotime($r['waktu'])) : '-';
        ?>
        <div class="card">
            <div class="photo-wrap">
                <img src="<?= htmlspecialchars($fotoUrl, ENT_QUOTES) ?>"
                     alt="<?= htmlspecialchars($r['namapegawai']) ?>"
                     loading="lazy"
                     onerror="this.onerror=null;this.src='<?= $placeholder ?>';">
            </div>

            <span class="badge-top"><?= htmlspecialchars(sensor_nip($r['nip'])) ?></span>

            <div class="overlay">
                <div class="nama"><?= htmlspecialchars($r['namapegawai']) ?></div>
                <div class="jabatan"><?= htmlspecialchars($r['jabatan']) ?></div>
                <div class="meta">
                    <span class="waktu"><?= htmlspecialchars($waktu) ?></span>
                    <span class="stat <?= $cls ?>"><?= htmlspecialchars($stat) ?></span>
                </div>
            </div>
        </div>
        <?php endforeach; ?>
    <?php endif; ?>
    </div>

    <script>
        function tickHeader() {
            const now = new Date();
            const jam   = String(now.getHours()).padStart(2, '0');
            const menit = String(now.getMinutes()).padStart(2, '0');
            const detik = String(now.getSeconds()).padStart(2, '0');
            document.getElementById('jamHeader').textContent = jam + ':' + menit + ':' + detik;

            const hari = ['Minggu','Senin','Selasa','Rabu','Kamis','Jumat','Sabtu'][now.getDay()];
            const bln  = ['Januari','Februari','Maret','April','Mei','Juni','Juli',
                          'Agustus','September','Oktober','November','Desember'][now.getMonth()];
            document.getElementById('tanggalHeader').textContent =
                hari + ', ' + now.getDate() + ' ' + bln + ' ' + now.getFullYear();

            if (now.getHours() >= 15 || now.getHours() < 6) location.reload();
        }
        tickHeader();
        setInterval(tickHeader, 1000);
        
    </script>

<?php endif; ?>

</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit