home
/
u529748449
/
domains
/
borabilhete.com
/
public_html
/
public
➕ New
📤 Upload
✎ Editing:
meus_ingressos.php
← Back
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); session_start(); include '../admin/conexao.php'; // Verifica se o cliente está logado if (!isset($_SESSION['cliente_id'])) { header("Location: login.php"); exit; } $cliente_id = $_SESSION['cliente_id']; $cliente_nome = $_SESSION['cliente_nome'] ?? ''; // Busca o CPF do cliente logado $stmtCpf = $conn->prepare("SELECT cpf FROM clientes WHERE id = ?"); $stmtCpf->bind_param("i", $cliente_id); $stmtCpf->execute(); $resultCpf = $stmtCpf->get_result(); $cliente = $resultCpf->fetch_assoc(); $cpf_cliente = preg_replace('/\D/', '', $cliente['cpf'] ?? ''); // Consulta os pedidos pagos do cliente usando o CPF normalizado $stmt = $conn->prepare(" SELECT p.id, p.criado_em, p.status_pagamento, p.token_seguro FROM pedidos p WHERE REPLACE(REPLACE(REPLACE(p.cpf, '.', ''), '-', ''), ' ', '') = ? AND p.status_pagamento = 'pago' ORDER BY p.criado_em DESC "); $stmt->bind_param("s", $cpf_cliente); $stmt->execute(); $result = $stmt->get_result(); ?> <!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="UTF-8"> <title>Meus Ingressos</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="css/header.css"> <style> body { font-family: Arial, sans-serif; background: #f8f8f8; margin: 0px; } h2 { text-align: center; } .ingresso { background: white; padding: 15px; margin: 10px auto; max-width: 600px; border-radius: 8px; box-shadow: 0 0 5px #ccc; } .ingresso strong { color: #333; } .btn { display: inline-block; margin-top: 10px; padding: 8px 12px; background: #007bff; color: white; text-decoration: none; border-radius: 4px; } .btn:hover { background: #0056b3; } </style> </head> <body> <?php include __DIR__ . '/includes/header.php'; ?> <h2>🎫 Meus Ingressos</h2> <p style="text-align:center;">Bem-vindo, <strong><?= htmlspecialchars($cliente_nome) ?></strong></p> <p style="text-align:center;"> <a href="logout.php" style="color: red; text-decoration: none;">🚪 Sair da Conta</a> </p> <?php if ($result->num_rows > 0): ?> <?php while ($pedido = $result->fetch_assoc()): ?> <div class="ingresso"> <p><strong>Pedido #<?= htmlspecialchars($pedido['id']) ?></strong></p> <p><strong>Data:</strong> <?= date('d/m/Y H:i', strtotime($pedido['criado_em'])) ?></p> <p><strong>Status:</strong> <?= ucfirst(htmlspecialchars($pedido['status_pagamento'])) ?></p> <a class="btn" href="gerar_ingressos.php?token=<?= urlencode($pedido['token_seguro']) ?>" target="_blank"> 📥 Ver Ingressos </a> </div> <?php endwhile; ?> <?php else: ?> <p style="text-align:center;">Você ainda não comprou nenhum ingresso.</p> <?php endif; ?> </body> </html>
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel