Compare commits

..

1 Commits

Author SHA1 Message Date
Flatlogic Bot
f217ce10d6 Game 2025-10-22 14:21:59 +00:00
7 changed files with 320 additions and 148 deletions

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

@ -0,0 +1,47 @@
body {
font-family: 'system-ui', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif;
}
.navbar-brand {
font-weight: bold;
}
.hero {
background-image: linear-gradient(45deg, rgba(13, 110, 253, 0.8), rgba(111, 66, 193, 0.8)), url('https://images.pexels.com/photos/3165335/pexels-photo-3165335.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2');
background-size: cover;
background-position: center;
color: white;
padding: 6rem 0;
text-align: center;
}
.hero h1 {
font-size: 3.5rem;
font-weight: 700;
}
.card {
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
border: none;
border-radius: 0.5rem;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
.card-title {
color: #0D6EFD;
font-weight: bold;
}
.btn-primary {
background-image: linear-gradient(45deg, #0D6EFD, #6F42C1);
border: none;
transition: transform 0.2s;
}
.btn-primary:hover {
transform: scale(1.05);
}

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

@ -0,0 +1,4 @@
// For future interactivity
document.addEventListener('DOMContentLoaded', function () {
console.log('GameTourney JS loaded!');
});

98
db/setup.php Normal file
View File

@ -0,0 +1,98 @@
<?php
function setup_database() {
try {
$pdo = db();
// Turn on errors
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Organisers Table
$pdo->exec("CREATE TABLE IF NOT EXISTS organisers (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=INNODB;");
// Venues Table
$pdo->exec("CREATE TABLE IF NOT EXISTS venues (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
location TEXT,
capacity INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=INNODB;");
// Games Table
$pdo->exec("CREATE TABLE IF NOT EXISTS games (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
game_date DATETIME NOT NULL,
venue_id INT,
organiser_id INT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (venue_id) REFERENCES venues(id) ON DELETE SET NULL,
FOREIGN KEY (organiser_id) REFERENCES organisers(id) ON DELETE CASCADE
) ENGINE=INNODB;");
// Players Table
$pdo->exec("CREATE TABLE IF NOT EXISTS players (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=INNODB;");
// Registrations Table
$pdo->exec("CREATE TABLE IF NOT EXISTS registrations (
id INT AUTO_INCREMENT PRIMARY KEY,
player_id INT NOT NULL,
game_id INT NOT NULL,
registration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
status VARCHAR(50) DEFAULT 'confirmed', -- confirmed, cancelled
FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE CASCADE,
FOREIGN KEY (game_id) REFERENCES games(id) ON DELETE CASCADE,
UNIQUE(player_id, game_id)
) ENGINE=INNODB;");
// Winners Table
$pdo->exec("CREATE TABLE IF NOT EXISTS winners (
id INT AUTO_INCREMENT PRIMARY KEY,
game_id INT NOT NULL,
player_id INT NOT NULL,
prize VARCHAR(255),
announced_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (game_id) REFERENCES games(id) ON DELETE CASCADE,
FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE CASCADE,
UNIQUE(game_id) -- Only one winner per game
) ENGINE=INNODB;");
// Seed data if tables are empty
$stmt = $pdo->query("SELECT COUNT(*) FROM games");
if ($stmt->fetchColumn() == 0) {
// Seed venues
$pdo->exec("INSERT INTO venues (name, location, capacity) VALUES ('Main Arena', '123 Gaming St, Metropolia', 1000), ('Community Hall', '456 Sidequest Ave, Townsville', 150);");
$venue1_id = $pdo->lastInsertId();
$venue2_id = $pdo->lastInsertId() -1;
// Seed organisers
$pdo->exec("INSERT INTO organisers (name, email, password) VALUES ('Tournament Master', 'admin@tourney.com', '".password_hash('password', PASSWORD_DEFAULT)."');");
$organiser_id = $pdo->lastInsertId();
// Seed games
$pdo->exec("INSERT INTO games (name, description, game_date, venue_id, organiser_id) VALUES
('Cyberclash 2025', 'The ultimate esports showdown. Featuring top players from around the globe.', '2025-11-15 10:00:00', $venue2_id, $organiser_id),
('Pixel Masters Cup', 'A celebration of retro gaming and modern indies.', '2025-12-01 12:00:00', $venue1_id, $organiser_id),
('Strategy Summit', 'For the grandmasters of turn-based and real-time strategy.', '2026-01-20 09:00:00', $venue2_id, $organiser_id);");
}
return ['success' => true];
} catch (PDOException $e) {
// In a real app, log this error instead of echoing
return ['success' => false, 'error' => $e->getMessage()];
}
}
?>

16
footer.php Normal file
View File

@ -0,0 +1,16 @@
</main>
<footer class="bg-dark text-white text-center p-4 mt-5">
<div class="container">
<p>&copy; <?php echo date('Y'); ?> GameTourney. All Rights Reserved.</p>
<p>
<a href="#" class="text-white">Privacy Policy</a> |
<a href="#" class="text-white">Terms of Service</a>
</p>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>

69
games.php Normal file
View File

@ -0,0 +1,69 @@
<?php
require_once 'db/config.php';
require_once 'db/setup.php';
// Run setup to ensure tables and data exist
$setup_result = setup_database();
// Fetch games from the database
$games = [];
$error_message = '';
if ($setup_result['success']) {
try {
$pdo = db();
$stmt = $pdo->prepare(
"SELECT g.id, g.name, g.description, g.game_date, v.name as venue_name
FROM games g
LEFT JOIN venues v ON g.venue_id = v.id
ORDER BY g.game_date ASC"
);
$stmt->execute();
$games = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
$error_message = "Error fetching tournaments: " . $e->getMessage();
}
} else {
$error_message = "Database setup failed: " . ($setup_result['error'] ?? 'Unknown error');
}
include 'header.php';
?>
<div class="container">
<div class="text-center mb-5">
<h1 class="display-4">Upcoming Tournaments</h1>
<p class="lead text-muted">Join the thrill of competition. Find your next challenge below.</p>
</div>
<?php if ($error_message): ?>
<div class="alert alert-danger">
<?php echo htmlspecialchars($error_message); ?>
</div>
<?php elseif (empty($games)): ?>
<div class="alert alert-info text-center">
<h2>Stay Tuned!</h2>
<p>No upcoming tournaments at the moment. Please check back soon!</p>
</div>
<?php else: ?>
<div class="row g-4">
<?php foreach ($games as $game): ?>
<div class="col-md-6 col-lg-4">
<div class="card h-100 shadow-sm">
<div class="card-body d-flex flex-column">
<h5 class="card-title"><?php echo htmlspecialchars($game['name']); ?></h5>
<p class="card-text text-muted flex-grow-1"><?php echo htmlspecialchars($game['description']); ?></p>
<ul class="list-unstyled text-muted mb-4">
<li><i class="bi bi-calendar-event text-primary"></i> <?php echo date('F j, Y @ g:i A', strtotime($game['game_date'])); ?></li>
<li><i class="bi bi-geo-alt-fill text-primary"></i> <?php echo htmlspecialchars($game['venue_name'] ?? 'TBA'); ?></li>
</ul>
<a href="#" class="btn btn-primary mt-auto">Register Now</a>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php include 'footer.php'; ?>

49
header.php Normal file
View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game Tournament Management</title>
<meta name="description" content="A system to manage game tournaments, players, and venues. Built with Flatlogic Generator.">
<meta name="keywords" content="game tournament, esports management, player registration, tournament bracket, venue management, game results, winner announcement, organiser tools, Built with Flatlogic Generator">
<meta property="og:title" content="Game Tournament Management">
<meta property="og:description" content="A system to manage game tournaments, players, and venues. Built with Flatlogic Generator.">
<meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
</head>
<body class="bg-light">
<nav class="navbar navbar-expand-lg navbar-dark" style="background-image: linear-gradient(45deg, #0D6EFD, #6F42C1);">
<div class="container">
<a class="navbar-brand" href="index.php">
<i class="bi bi-trophy-fill"></i>
GameTourney
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link active" href="index.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="games.php">Tournaments</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Login</a>
</li>
<li class="nav-item">
<a class="nav-link btn btn-outline-light" href="#">Register</a>
</li>
</ul>
</div>
</div>
</nav>
<main class="container my-5">

183
index.php
View File

@ -1,150 +1,39 @@
<?php
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
<?php include 'header.php'; ?>
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$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>
<body>
<main>
<div class="card">
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
<div class="hero">
<div class="container">
<h1 class="display-3">Welcome to GameTourney</h1>
<p class="lead">The ultimate platform for competitive gaming tournaments.</p>
<a href="games.php" class="btn btn-primary btn-lg mt-3">Browse Tournaments</a>
</div>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will update automatically as the plan is implemented.</p>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
</body>
</html>
<section class="py-5">
<div class="container">
<div class="row text-center">
<div class="col-md-4">
<div class="p-4">
<i class="bi bi-joystick display-4 text-primary"></i>
<h3 class="mt-3">Compete</h3>
<p class="text-muted">Join tournaments and challenge players.</p>
</div>
</div>
<div class="col-md-4">
<div class="p-4">
<i class="bi bi-people-fill display-4 text-primary"></i>
<h3 class="mt-3">Community</h3>
<p class="text-muted">Connect with fellow gamers and friends.</p>
</div>
</div>
<div class="col-md-4">
<div class="p-4">
<i class="bi bi-trophy-fill display-4 text-primary"></i>
<h3 class="mt-3">Conquer</h3>
<p class="text-muted">Climb the ranks and claim victory.</p>
</div>
</div>
</div>
</div>
</section>
<?php include 'footer.php'; ?>