diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..91e9111 --- /dev/null +++ b/assets/css/custom.css @@ -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); +} \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..1729203 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,4 @@ +// For future interactivity +document.addEventListener('DOMContentLoaded', function () { + console.log('GameTourney JS loaded!'); +}); \ No newline at end of file diff --git a/db/setup.php b/db/setup.php new file mode 100644 index 0000000..c58144e --- /dev/null +++ b/db/setup.php @@ -0,0 +1,98 @@ +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()]; + } +} +?> \ No newline at end of file diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..8ecd3a1 --- /dev/null +++ b/footer.php @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/games.php b/games.php new file mode 100644 index 0000000..a07d3b9 --- /dev/null +++ b/games.php @@ -0,0 +1,69 @@ +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'; +?> + +
+
+

Upcoming Tournaments

+

Join the thrill of competition. Find your next challenge below.

+
+ + +
+ +
+ +
+

Stay Tuned!

+

No upcoming tournaments at the moment. Please check back soon!

+
+ +
+ +
+
+
+
+

+
    +
  • +
  • +
+ Register Now +
+
+
+ +
+ +
+ + \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 0000000..edf3d19 --- /dev/null +++ b/header.php @@ -0,0 +1,49 @@ + + + + + + Game Tournament Management + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/index.php b/index.php index 7205f3d..8bf29c8 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,39 @@ - -$phpVersion = PHP_VERSION; -$now = date('Y-m-d H:i:s'); -?> - - - - - - New Style - - - - - - - - - - - - - - - - - - - - - -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

+
+
+

Welcome to GameTourney

+

The ultimate platform for competitive gaming tournaments.

+ Browse Tournaments
-
- - - + + +
+
+
+
+
+ +

Compete

+

Join tournaments and challenge players.

+
+
+
+
+ +

Community

+

Connect with fellow gamers and friends.

+
+
+
+
+ +

Conquer

+

Climb the ranks and claim victory.

+
+
+
+
+
+ + \ No newline at end of file