This commit is contained in:
Ben Harris 2021-08-19 15:33:12 -04:00
commit 64bbcf7626
12 changed files with 112 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
pinball.db

7
README.md Normal file
View File

@ -0,0 +1,7 @@
# nomi pinball
webapp for pinball tourneys at coinslot
php + sqlite
sqlite3 pinball.db < schema.sql

BIN
coinslotlogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

11
creatematch/index.php Normal file
View File

@ -0,0 +1,11 @@
<?php
include __DIR__.'/../header.php';
include __DIR__.'/../db.php';
?>
<h1>start a match</h1>
<p><a href="/">back</a></p>
<hr>
<?php
include __DIR__.'/../footer.php';

3
db.php Normal file
View File

@ -0,0 +1,3 @@
<?php
$db = new PDO("sqlite:".__DIR__."/pinball.db");

3
footer.php Normal file
View File

@ -0,0 +1,3 @@
</main>
</body>
</html>

1
gruvbox.min.css vendored Normal file
View File

@ -0,0 +1 @@
main{-webkit-font-feature-settings:"liga" on,"calt" on;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;font-family:'JetBrains Mono','Input Mono',monospace;max-width:38rem;padding:2rem;margin:auto}@media only screen and (max-device-width:736px){main{padding:.2rem}}::selection{background:#9c0018}body{background:#282828;color:#ebdbb2}pre{background-color:#3c3836;padding:1em;border:0}a,a:active,a:visited{color:#e491b6;background-color:#1d2021}h1,h2,h3,h4,h5{margin-bottom:.1rem}blockquote{border-left:1px solid #bdae93;margin:.5em 10px;padding:.5em 10px}footer{align:center}img{max-width:100%}

9
header.php Normal file
View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>nomi pinball</title>
<link rel="stylesheet" href="/gruvbox.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body id="top">
<main>

31
index.php Normal file
View File

@ -0,0 +1,31 @@
<?php
require_once 'db.php';
$tables = $db->query('select * from tables');
include 'header.php';
?>
<h1>nomi pinball</h1>
<img src="coinslotlogo.png" alt="coin slot logo">
<hr>
<p>
<a href="/random/">pick a table to play</a> ~
<a href="/creatematch/">start a match</a>
</p>
<pre>* keep tables up-to-date
* table picker
* track players
* team picker
* ifpa integration - their API is currently read-only
* stream games onto a TV
* keep track of ranking from each game
* show ranking table
* show tournament rankings as we go
</pre>
<ul>
<?php foreach ($tables as $table) { ?>
<li><?=$table['name']?></li>
<?php } ?>
</ul>
<?php include 'footer.php'; ?>

13
random/index.php Normal file
View File

@ -0,0 +1,13 @@
<?php
include __DIR__.'/../header.php';
include __DIR__.'/../db.php';
$tbl = $db->query('select name from tables where active = 1 limit 1 offset abs(random()) % max((select count(*) from tables), 1)')->fetchColumn();
?>
<h1>your random table</h1>
<p><a href="/">back</a></p>
<hr>
<strong><?=$tbl?></strong>
<?php
include __DIR__.'/../footer.php';

20
schema.sql Normal file
View File

@ -0,0 +1,20 @@
create table if not exists tables (
tableid INTEGER PRIMARY KEY ASC,
name TEXT,
edition TEXT,
active INT
);
create table if not exists tournaments (
tournamentid INTEGER PRIMARY KEY ASC,
date DATE,
description TEXT
);
create table if not exists players (
playerid INTEGER PRIMARY KEY ASC,
name TEXT,
tournament INTEGER,
FOREIGN KEY(tournament) REFERENCES tournaments(tournamentid)
);

13
tables.txt Normal file
View File

@ -0,0 +1,13 @@
Avengers
Deadpool
Family Guy
Guardians of the Galaxy
Jurassic Park
Monster Bash
Rick & Morty
Simpsons
Star Trek
Star Wars
Teenage Mutant Ninja Turtles
The Mandalorian
Walking Dead