diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2023-04-03 22:12:41 +0200 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2023-04-03 22:12:41 +0200 |
| commit | 1df1ff6f074528a4ad6d4015c794a1555c1c942f (patch) | |
| tree | ad3b16291748c60441967996706006555919ef73 /public | |
| parent | c813dfadd4b673080695ef3ade37a44e37036c07 (diff) | |
| download | fia-1df1ff6f074528a4ad6d4015c794a1555c1c942f.tar.gz fia-1df1ff6f074528a4ad6d4015c794a1555c1c942f.tar.zst fia-1df1ff6f074528a4ad6d4015c794a1555c1c942f.zip | |
Polishing up
Add all files to repo
Add sql database
Correct urls
Add PHP code to repo
Update README.md with instructions how to start
Move from yarn to pnpm
Fix all issues with starting
Fix possibility of player changing their dice roll with refreshing the game
Diffstat (limited to 'public')
| -rw-r--r-- | public/css/fia.css | 22 | ||||
| -rwxr-xr-x | public/imgs/chequer-blue.png | bin | 0 -> 7190 bytes | |||
| -rwxr-xr-x | public/imgs/chequer-green.png | bin | 0 -> 13153 bytes | |||
| -rwxr-xr-x | public/imgs/chequer-red.png | bin | 0 -> 10981 bytes | |||
| -rwxr-xr-x | public/imgs/chequer-yellow.png | bin | 0 -> 12357 bytes | |||
| -rwxr-xr-x | public/imgs/dice-1.png | bin | 0 -> 42445 bytes | |||
| -rwxr-xr-x | public/imgs/dice-2.png | bin | 0 -> 50881 bytes | |||
| -rwxr-xr-x | public/imgs/dice-3.png | bin | 0 -> 70612 bytes | |||
| -rwxr-xr-x | public/imgs/dice-4.png | bin | 0 -> 73484 bytes | |||
| -rwxr-xr-x | public/imgs/dice-5.png | bin | 0 -> 68973 bytes | |||
| -rwxr-xr-x | public/imgs/dice-6.png | bin | 0 -> 88847 bytes | |||
| -rwxr-xr-x | public/imgs/fia.png | bin | 0 -> 27383 bytes | |||
| -rw-r--r-- | public/index.html | 6 | ||||
| -rw-r--r-- | public/php/dbCredentials.php | 4 | ||||
| -rw-r--r-- | public/php/fia.php | 34 |
15 files changed, 52 insertions, 14 deletions
diff --git a/public/css/fia.css b/public/css/fia.css index 80d5b61..93d4c6d 100644 --- a/public/css/fia.css +++ b/public/css/fia.css @@ -2,7 +2,7 @@ width: 660px; height: 660px; margin: 0 auto; - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/fia.png"); + background-image: url("../imgs/fia.png"); background-size: contain; border-collapse: separate; padding: 0; @@ -32,22 +32,22 @@ background-size: contain; } .dice-1 { - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/dice-1.png"); + background-image: url("../imgs/dice-1.png"); } .dice-2 { - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/dice-2.png"); + background-image: url("../imgs/dice-2.png"); } .dice-3 { - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/dice-3.png"); + background-image: url("../imgs/dice-3.png"); } .dice-4 { - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/dice-4.png"); + background-image: url("../imgs/dice-4.png"); } .dice-5 { - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/dice-5.png"); + background-image: url("../imgs/dice-5.png"); } .dice-6 { - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/dice-6.png"); + background-image: url("../imgs/dice-6.png"); } .player-name :nth-child(even) { @@ -61,19 +61,19 @@ -webkit-text-stroke: 5px black; } .chequer-red { - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/chequer-red.png"); + background-image: url("../imgs/chequer-red.png"); border: 4px solid black; } .chequer-blue { - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/chequer-blue.png"); + background-image: url("../imgs/chequer-blue.png"); border: 4px solid black; } .chequer-green { - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/chequer-green.png"); + background-image: url("../imgs/chequer-green.png"); border: 4px solid black; } .chequer-yellow { - background-image: url("https://jopek.eu/maks/szkola/apkKli/fiaFiles/chequer-yellow.png"); + background-image: url("../imgs/chequer-yellow.png"); border: 4px solid black; } .chequer-white { diff --git a/public/imgs/chequer-blue.png b/public/imgs/chequer-blue.png Binary files differnew file mode 100755 index 0000000..67d3b94 --- /dev/null +++ b/public/imgs/chequer-blue.png diff --git a/public/imgs/chequer-green.png b/public/imgs/chequer-green.png Binary files differnew file mode 100755 index 0000000..bcca402 --- /dev/null +++ b/public/imgs/chequer-green.png diff --git a/public/imgs/chequer-red.png b/public/imgs/chequer-red.png Binary files differnew file mode 100755 index 0000000..878cdc2 --- /dev/null +++ b/public/imgs/chequer-red.png diff --git a/public/imgs/chequer-yellow.png b/public/imgs/chequer-yellow.png Binary files differnew file mode 100755 index 0000000..bf74e1a --- /dev/null +++ b/public/imgs/chequer-yellow.png diff --git a/public/imgs/dice-1.png b/public/imgs/dice-1.png Binary files differnew file mode 100755 index 0000000..c698476 --- /dev/null +++ b/public/imgs/dice-1.png diff --git a/public/imgs/dice-2.png b/public/imgs/dice-2.png Binary files differnew file mode 100755 index 0000000..9eb260d --- /dev/null +++ b/public/imgs/dice-2.png diff --git a/public/imgs/dice-3.png b/public/imgs/dice-3.png Binary files differnew file mode 100755 index 0000000..f5d53d0 --- /dev/null +++ b/public/imgs/dice-3.png diff --git a/public/imgs/dice-4.png b/public/imgs/dice-4.png Binary files differnew file mode 100755 index 0000000..b4fca33 --- /dev/null +++ b/public/imgs/dice-4.png diff --git a/public/imgs/dice-5.png b/public/imgs/dice-5.png Binary files differnew file mode 100755 index 0000000..6f9d5de --- /dev/null +++ b/public/imgs/dice-5.png diff --git a/public/imgs/dice-6.png b/public/imgs/dice-6.png Binary files differnew file mode 100755 index 0000000..a51e5b3 --- /dev/null +++ b/public/imgs/dice-6.png diff --git a/public/imgs/fia.png b/public/imgs/fia.png Binary files differnew file mode 100755 index 0000000..9597560 --- /dev/null +++ b/public/imgs/fia.png diff --git a/public/index.html b/public/index.html index 9cc5532..617de91 100644 --- a/public/index.html +++ b/public/index.html @@ -5,8 +5,8 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Fia</title> - <link rel="stylesheet" href="fia/css/bootstrap.min.css" /> - <link rel="stylesheet" href="fia/css/fia.css" /> + <link rel="stylesheet" href="css/bootstrap.min.css" /> + <link rel="stylesheet" href="css/fia.css" /> </head> <body class="bg-dark text-white"> <noscript> @@ -14,6 +14,6 @@ Tyvärr, men för att spela Fia måste du aktivera skript </div> </noscript> - <script src="fia/js/frontend/ts/login.js" type="module"></script> + <script src="js/frontend/ts/login.js" type="module"></script> </body> </html> diff --git a/public/php/dbCredentials.php b/public/php/dbCredentials.php new file mode 100644 index 0000000..87bbfd5 --- /dev/null +++ b/public/php/dbCredentials.php @@ -0,0 +1,4 @@ +<?php + $apiKey = "secureApiKey123(!*"; + $dbUser = "admin"; + $dbPassword = "qwerty123"; diff --git a/public/php/fia.php b/public/php/fia.php new file mode 100644 index 0000000..b9f45f1 --- /dev/null +++ b/public/php/fia.php @@ -0,0 +1,34 @@ +<?php +error_reporting(E_ALL); +ini_set('display_errors', 1); + +$req = json_decode(file_get_contents("php://input")); +require_once "dbCredentials.php"; + +if ($req->apiKey === $apiKey) { + $http = isset($_SERVER["HTTPS"]) ? "https" : "http"; + header("Access-Control-Allow-Origin: $http://localhost:8000"); + $pdo = new PDO("mysql:dbname=ClientApps;host=localhost;charset=utf8mb4", $dbUser, $dbPassword); + $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); + $stmt = $pdo->prepare($req->query); + try { + $params = []; + foreach ($req->params as $v) { + if(is_string($v)) + array_push($params, $v); + else + array_push($params, json_encode($v)); + } + $stmt->execute($params); + } catch (PDOException $e) { + echo "ERROR!!!"; + var_dump($req); + var_dump($stmt); + throw $e; + } + echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC)); + http_response_code(200); +} else { + echo "Wrong username or password!"; + http_response_code(401); +} |
