36649-vm/index.php
2025-12-05 15:02:14 +00:00

127 lines
7.0 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Football Match Analysis</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body>
<header class="bg-primary text-white text-center py-3">
<h1><i class="fas fa-futbol"></i> Football Match Analysis</h1>
</header>
<main class="container my-5">
<div class="card shadow-sm">
<div class="card-body">
<h5 class="card-title">Análise de Partida</h5>
<form id="analysis-form">
<div class="mb-3">
<label for="home-team" class="form-label">Time da Casa</label>
<input type="text" class="form-control" id="home-team" placeholder="Digite o nome do time da casa" required>
</div>
<div class="mb-3">
<label for="away-team" class="form-label">Time Visitante</label>
<input type="text" class="form-control" id="away-team" placeholder="Digite o nome do time visitante" required>
</div>
<button type="submit" class="btn btn-primary w-100">Analisar Partida</button>
</form>
</div>
</div>
<div id="analysis-result" class="mt-4" style="display: none;">
<div class="d-flex justify-content-center">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
</div>
<div class="card shadow-sm mt-4">
<div class="card-body" id="odds-section">
<h5 class="card-title">Próximas Partidas e Odds (Premier League)</h5>
<?php
require_once 'includes/odds_api.php';
$odds_data = get_odds('soccer_epl', 'uk', 'h2h');
if ($odds_data && !empty($odds_data)) {
// Set timezone to Brazil
date_default_timezone_set('America/Sao_Paulo');
foreach ($odds_data as $match) {
$match_time = strtotime($match['commence_time']);
?>
<div class="card mb-3">
<div class="card-header fw-bold">
<?php echo htmlspecialchars($match['home_team']) . ' vs ' . htmlspecialchars($match['away_team']); ?>
<span class="float-end badge bg-secondary"><?php echo date('d/m/Y H:i', $match_time); ?></span>
</div>
<div class="card-body p-0">
<table class="table table-striped table-sm mb-0">
<thead class="table-light">
<tr>
<th>Casa de Apostas</th>
<th class="text-center">1 (Casa)</th>
<th class="text-center">X (Empate)</th>
<th class="text-center">2 (Fora)</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($match['bookmakers'])) {
foreach ($match['bookmakers'] as $bookmaker) {
$home_odd = 'N/A';
$draw_odd = 'N/A';
$away_odd = 'N/A';
foreach ($bookmaker['markets'] as $market) {
if ($market['key'] === 'h2h') {
foreach ($market['outcomes'] as $outcome) {
if ($outcome['name'] === $match['home_team']) {
$home_odd = htmlspecialchars($outcome['price']);
} elseif ($outcome['name'] === $match['away_team']) {
$away_odd = htmlspecialchars($outcome['price']);
} elseif ($outcome['name'] === 'Draw') {
$draw_odd = htmlspecialchars($outcome['price']);
}
}
}
}
?>
<tr>
<td><?php echo htmlspecialchars($bookmaker['title']); ?></td>
<td class="text-center"><?php echo $home_odd; ?></td>
<td class="text-center"><?php echo $draw_odd; ?></td>
<td class="text-center"><?php echo $away_odd; ?></td>
</tr>
<?php
}
} else {
echo '<tr><td colspan="4" class="text-center">Nenhuma casa de aposta disponível para esta partida.</td></tr>';
}
?>
</tbody>
</table>
</div>
</div>
<?php
}
} else {
echo '<div class="alert alert-warning" role="alert">Não foi possível buscar as odds no momento. Verifique sua chave de API ou tente novamente mais tarde.</div>';
}
?>
</div>
</div>
</main>
<footer class="text-center py-3 bg-light">
<p class="mb-0">&copy; 2025 Football Match Analysis. All Rights Reserved.</p>
<p class="mb-0 fst-italic">Note: Odds and bookmakers are estimates. Always consult the betting sites for real-time values.</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>