File manager - Edit - /home/webtrixia/democloud.webtrixia.com/share.php
Back
<?php require_once __DIR__ . '/includes/config.php'; require_once __DIR__ . '/includes/db.php'; require_once __DIR__ . '/includes/functions.php'; $token = trim($_GET['t'] ?? ''); if (!$token) { http_response_code(404); die('Невалиден линк.'); } $share = DB::fetch("SELECT s.*, f.name, f.size, f.mime_type, f.stored_name, f.path, f.extension, f.original_name, c.name as company_name, u.name as shared_by FROM shares s JOIN files f ON f.id = s.file_id JOIN companies c ON c.id = s.company_id JOIN users u ON u.id = s.created_by WHERE s.token = ? AND (s.expires_at IS NULL OR s.expires_at > NOW())", [$token]); if (!$share) { http_response_code(404); } $expired = !$share; $can_download = $share && in_array($share['permission'], ['download', 'edit']); if ($share && $_GET['dl'] ?? false) { DB::query("UPDATE shares SET access_count = access_count + 1 WHERE token = ?", [$token]); $filepath = $share['path'] . $share['stored_name']; header('Content-Type: ' . $share['mime_type']); header('Content-Disposition: attachment; filename="' . $share['original_name'] . '"'); header('Content-Length: ' . $share['size']); readfile($filepath); exit; } ?> <!DOCTYPE html> <html lang="bg"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><?= $share ? e($share['name']) . ' — ' . APP_NAME : APP_NAME . ' — Невалиден линк' ?></title> <link href="https://fonts.googleapis.com/css2?family=Unbounded:wght@600;800&family=DM+Sans:wght@400;500&display=swap" rel="stylesheet"> <style> *{box-sizing:border-box;margin:0;padding:0} body{font-family:'DM Sans',sans-serif;background:#0d0f14;color:#eaedf5;min-height:100vh;display:flex;align-items:center;justify-content:center} .card{background:#161921;border:1px solid #252a3a;border-radius:20px;padding:40px;max-width:400px;width:94%;text-align:center} .app-name{font-family:'Unbounded',sans-serif;font-size:12px;font-weight:600;color:#6b748f;margin-bottom:24px;text-transform:uppercase;letter-spacing:1px} .file-ico{font-size:56px;margin-bottom:16px} .file-name{font-size:18px;font-weight:600;margin-bottom:6px;word-break:break-word} .file-meta{font-size:13px;color:#6b748f;margin-bottom:6px} .shared-by{font-size:12px;color:#6b748f;margin-bottom:28px} .btn{display:inline-flex;align-items:center;gap:8px;padding:12px 24px;border-radius:10px;border:none;cursor:pointer;font-size:14px;font-weight:600;font-family:'DM Sans',sans-serif;transition:all 0.2s;text-decoration:none} .btn-dl{background:#4f8fff;color:#fff;width:100%;justify-content:center} .btn-dl:hover{background:#3a7bef} .btn-view{background:#1e2230;color:#eaedf5;border:1px solid #252a3a;width:100%;justify-content:center;margin-top:10px} .error{color:#f87171;font-size:14px} </style> </head> <body> <div class="card"> <div class="app-name"><?= APP_NAME ?></div> <?php if ($expired): ?> <div style="font-size:40px;margin-bottom:16px">🔗</div> <div class="file-name">Линкът е изтекъл</div> <p class="file-meta" style="margin-top:8px">Свържете се с подателя за нов линк.</p> <?php else: ?> <div class="file-ico"><?= getFileIcon($share['extension']) ?></div> <div class="file-name"><?= e($share['name']) ?></div> <div class="file-meta"><?= formatBytes($share['size']) ?> · <?= strtoupper($share['extension'] ?? 'файл') ?></div> <div class="shared-by">Споделено от <strong><?= e($share['shared_by']) ?></strong> · <?= e($share['company_name']) ?></div> <?php if ($can_download): ?> <a href="?t=<?= e($token) ?>&dl=1" class="btn btn-dl">⬇ Изтегли файла</a> <?php else: ?> <div style="background:#1e2230;border:1px solid #252a3a;border-radius:10px;padding:14px;font-size:13px;color:#6b748f"> Само преглед — изтеглянето не е разрешено. </div> <?php endif; ?> <?php endif; ?> </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.31 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings