403Webshell
Server IP : 193.86.120.172  /  Your IP : 216.73.216.67
Web Server : Apache/2.4.63 (Unix)
System : Linux JServices 3.10.108 #86003 SMP Wed Oct 22 13:20:46 CST 2025 x86_64
User : kubec ( 1026)
PHP Version : 8.2.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /volume1/web/kadernictvi_jservices_cz/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /volume1/web/kadernictvi_jservices_cz/hodnoceni.php
<?php
require_once __DIR__ . '/includes/db.php';
require_once __DIR__ . '/includes/mailer.php';

$token  = sanitize($_GET['token'] ?? '');
$hvezdy = isset($_GET['hvezdy']) ? (int)$_GET['hvezdy'] : null;
$error  = '';
$rezervace = null;
$uspech = false;

if (strlen($token) !== 64) { $error = 'Neplatný odkaz.'; }

if (!$error) {
    $stmt = db()->prepare("
        SELECT r.*, s.nazev AS sluzba_nazev, s.cena AS sluzba_cena
        FROM rezervace r JOIN sluzby s ON s.id = r.sluzba_id
        WHERE r.token_zmena = ?
    ");
    $stmt->execute([$token]);
    $rezervace = $stmt->fetch();

    if (!$rezervace) {
        $error = 'Rezervace nenalezena.';
    } elseif ($rezervace['stav'] === 'zrusena') {
        $error = 'Tato rezervace byla zrušena, hodnocení nelze přidat.';
    }
}

// Pokud je hodnocení v rezervaci již uloženo, jen zobraz
if (!$error && $rezervace['hodnoceni'] !== null) {
    $uspech = true;
    $hvezdy = (int)$rezervace['hodnoceni'];
}

// Ulož nové hodnocení
if (!$error && $rezervace['hodnoceni'] === null && $hvezdy !== null) {
    if ($hvezdy < 1 || $hvezdy > 5) {
        $error = 'Neplatné hodnocení.';
    } else {
        db()->prepare("UPDATE rezervace SET hodnoceni = ? WHERE id = ?")
           ->execute([$hvezdy, $rezervace['id']]);
        $uspech = true;

        // Notifikace adminovi
        try {
            email_nove_hodnoceni($rezervace, $hvezdy);
        } catch (Exception $e) {
            error_log('[Hodnoceni] Email admin error: ' . $e->getMessage());
        }
    }
}

$salon = salon_nazev();
?>
<!DOCTYPE html>
<html lang="cs">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Hodnocení – <?= htmlspecialchars($salon) ?></title>
<style>
*{box-sizing:border-box;margin:0;padding:0}
html,body{max-width:100%;overflow-x:hidden}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;background:#f9fafb;color:#111827;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:1rem}
.box{background:#fff;border:1px solid #e5e7eb;border-radius:20px;padding:2rem;max-width:380px;width:100%;text-align:center}
.logo{font-size:36px;margin-bottom:10px}
.salon{font-size:15px;font-weight:700;color:#7c3aed;margin-bottom:18px}
h1{font-size:18px;margin-bottom:8px}
.sub{font-size:13px;color:#6b7280;margin-bottom:20px}
.stars{display:flex;justify-content:center;gap:8px;margin:18px 0}
.star{display:flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:50%;background:#faf5ff;border:2px solid #e9d5ff;text-decoration:none;font-size:24px;color:#d8b4fe;transition:.15s}
.star:hover{border-color:#9333ea}
.star.filled{color:#f59e0b;border-color:#fde68a;background:#fffbeb}
.thanks-icon{font-size:40px;color:#9333ea;margin-bottom:10px}
.error{color:#991b1b;background:#fee2e2;border-radius:10px;padding:12px;font-size:14px}
.btn-back{display:inline-block;margin-top:18px;color:#7c3aed;font-size:13px;text-decoration:none}
</style>
</head>
<body>
<div class="box">
  <div class="logo">✂️</div>
  <div class="salon"><?= htmlspecialchars($salon) ?></div>

  <?php if ($error): ?>
    <div class="error"><?= htmlspecialchars($error) ?></div>
  <?php elseif ($uspech): ?>
    <div class="thanks-icon">✓</div>
    <h1>Děkujeme za hodnocení!</h1>
    <div class="stars">
      <?php for ($i = 1; $i <= 5; $i++): ?>
        <span class="star <?= $i <= $hvezdy ? 'filled' : '' ?>" style="cursor:default">★</span>
      <?php endfor; ?>
    </div>
    <p class="sub">Vaše hodnocení nám pomáhá zlepšovat naše služby.</p>
  <?php else: ?>
    <h1>Jak jste byl spokojen?</h1>
    <p class="sub"><?= htmlspecialchars($rezervace['sluzba_nazev']) ?> · <?= datum_cs($rezervace['datum']) ?></p>
    <div class="stars">
      <?php for ($i = 1; $i <= 5; $i++): ?>
        <a class="star" href="?token=<?= urlencode($token) ?>&hvezdy=<?= $i ?>">★</a>
      <?php endfor; ?>
    </div>
    <p class="sub">Klikněte na počet hvězdiček</p>
  <?php endif; ?>

  <a href="<?= BASE_URL ?>" class="btn-back">← Zpět na web</a>
</div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit