FUTBOOL ANALIZER TIME

This commit is contained in:
Flatlogic Bot 2025-12-04 13:03:37 +00:00
parent 8fbba81640
commit 1d590eb942
4 changed files with 224 additions and 145 deletions

29
assets/css/custom.css Normal file
View File

@ -0,0 +1,29 @@
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&family=Open+Sans&display=swap');
body {
background-color: #f8f9fa;
font-family: 'Open Sans', sans-serif;
}
h1, h5 {
font-family: 'Roboto', sans-serif;
font-weight: 700;
}
.btn-primary {
background-color: #1a73e8;
border-color: #1a73e8;
}
.btn-primary:hover {
background-color: #1765c4;
border-color: #1765c4;
}
.card {
border-radius: 0.5rem;
}
.form-control, .btn {
border-radius: 0.25rem;
}

75
assets/js/main.js Normal file
View File

@ -0,0 +1,75 @@
document.getElementById('analysis-form').addEventListener('submit', function(event) {
event.preventDefault();
const homeTeam = document.getElementById('home-team').value;
const awayTeam = document.getElementById('away-team').value;
if (!homeTeam || !awayTeam) {
alert('Por favor, digite os nomes dos dois times.');
return;
}
const analysisResult = document.getElementById('analysis-result');
analysisResult.style.display = 'block';
analysisResult.innerHTML = `
<div class="d-flex justify-content-center">
<div class="spinner-border text-primary" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
`;
setTimeout(() => {
const homeWinProb = (Math.random() * 50 + 25).toFixed(2);
const awayWinProb = (Math.random() * (75 - homeWinProb)).toFixed(2);
const drawProb = (100 - homeWinProb - awayWinProb).toFixed(2);
const homeOdds = (1 / (homeWinProb / 100)).toFixed(2);
const awayOdds = (1 / (awayWinProb / 100)).toFixed(2);
const drawOdds = (1 / (drawProb / 100)).toFixed(2);
analysisResult.innerHTML = `
<div class="card shadow-sm">
<div class="card-body">
<h5 class="card-title text-center">Análise da Partida: ${homeTeam} vs ${awayTeam}</h5>
<div class="row text-center my-4">
<div class="col-4">
<h6>Vitória ${homeTeam}</h6>
<p class="fs-4 text-primary">${homeWinProb}%</p>
</div>
<div class="col-4">
<h6>Empate</h6>
<p class="fs-4 text-secondary">${drawProb}%</p>
</div>
<div class="col-4">
<h6>Vitória ${awayTeam}</h6>
<p class="fs-4 text-primary">${awayWinProb}%</p>
</div>
</div>
<hr>
<h6 class="card-subtitle mb-2 text-muted">Odds Estimadas</h6>
<div class="row text-center">
<div class="col-4"><strong>${homeTeam}:</strong> ${homeOdds}</div>
<div class="col-4"><strong>Empate:</strong> ${drawOdds}</div>
<div class="col-4"><strong>${awayTeam}:</strong> ${awayOdds}</div>
</div>
<hr>
<h6 class="card-subtitle mb-2 text-muted">Recomendação da IA</h6>
<p>Com base na análise, a recomendação pende para uma vitória do <strong>${homeWinProb > awayWinProb ? homeTeam : awayTeam}</strong>, mas um empate também é uma possibilidade a ser considerada.</p>
<hr>
<h6 class="card-subtitle mb-2 text-muted">Casas de Apostas (Exemplo)</h6>
<ul class="list-group list-group-flush">
<li class="list-group-item d-flex justify-content-between">
<span>Bet365</span>
<span>${homeTeam}: ${(homeOdds * 1.05).toFixed(2)} | Empate: ${(drawOdds * 0.98).toFixed(2)} | ${awayTeam}: ${(awayOdds * 1.02).toFixed(2)}</span>
</li>
<li class="list-group-item d-flex justify-content-between">
<span>Betano</span>
<span>${homeTeam}: ${(homeOdds * 0.99).toFixed(2)} | Empate: ${(drawOdds * 1.01).toFixed(2)} | ${awayTeam}: ${(awayOdds * 1.04).toFixed(2)}</span>
</li>
</ul>
</div>
</div>
`;
}, 2000);
});

14
includes/odds_api.php Normal file
View File

@ -0,0 +1,14 @@
<?php
function get_odds($sport = 'soccer_epl', $regions = 'uk', $markets = 'h2h') {
$apiKey = '308deae256c9099c52e22bb4933a12b6';
$url = "https://api.the-odds-api.com/v4/sports/{$sport}/odds/?regions={$regions}&markets={$markets}&apiKey={$apiKey}";
$response = @file_get_contents($url);
if ($response === FALSE) {
return null;
}
return json_decode($response, true);
}
?>

251
index.php
View File

@ -1,150 +1,111 @@
<?php <!DOCTYPE html>
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>New Style</title> <title>Football Match Analysis</title>
<?php <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
// Read project preview data from environment <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? ''; <link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?php if ($projectDescription): ?>
<!-- Meta description -->
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
<!-- Open Graph meta tags -->
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<!-- Twitter meta tags -->
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?php endif; ?>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}
.loader {
margin: 1.25rem auto 1.25rem;
width: 48px;
height: 48px;
border: 3px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
</head> </head>
<body> <body>
<main> <header class="bg-primary text-white text-center py-3">
<div class="card"> <h1><i class="fas fa-futbol"></i> Football Match Analysis</h1>
<h1>Analyzing your requirements and generating your website…</h1> </header>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span> <main class="container my-5">
</div> <div class="card shadow-sm">
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p> <div class="card-body">
<p class="hint">This page will update automatically as the plan is implemented.</p> <h5 class="card-title">Análise de Partida</h5>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p> <form id="analysis-form">
</div> <div class="mb-3">
</main> <label for="home-team" class="form-label">Time da Casa</label>
<footer> <input type="text" class="form-control" id="home-team" placeholder="Digite o nome do time da casa" required>
Page updated: <?= htmlspecialchars($now) ?> (UTC) </div>
</footer> <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">
<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)) {
?>
<table class="table table-striped">
<thead>
<tr>
<th>Partida</th>
<th>Casa</th>
<th>Empate</th>
<th>Fora</th>
</tr>
</thead>
<tbody>
<?php foreach ($odds_data as $match): ?>
<tr>
<td><?php echo htmlspecialchars($match['home_team']) . ' vs ' . htmlspecialchars($match['away_team']); ?></td>
<?php
$home_odd = 'N/A';
$draw_odd = 'N/A';
$away_odd = 'N/A';
// Find the bookmaker (assuming there is at least one)
if (!empty($match['bookmakers'])) {
$bookmaker = $match['bookmakers'][0]; // Take the first bookmaker
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']);
}
}
}
}
}
?>
<td><?php echo $home_odd; ?></td>
<td><?php echo $draw_odd; ?></td>
<td><?php echo $away_odd; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?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> </body>
</html> </html>