From 3c0ebfbbcd9d41b936ede928af05db9f15733d1a Mon Sep 17 00:00:00 2001 From: hitlerrip Date: Tue, 29 Jul 2025 19:17:50 +0200 Subject: init base to build this game off of --- README.md | 25 +++++++++++++++++++++++++ backend/docker-test-env/compose.yml | 10 ++++++++++ backend/index.php | 17 +++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 README.md create mode 100644 backend/docker-test-env/compose.yml create mode 100644 backend/index.php diff --git a/README.md b/README.md new file mode 100644 index 0000000..d1eaec3 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# Hitler Clicker + +Hitler Clicker is a simple game where you have to choose one of 3 teams to click for. +The team with the most clicks wins, except that the game is endless. + +- - - + +## Test Environment + +There is an included testing environment. Requirements are Docker and PHP. +Docker is generally not needed, you can replace it with any other DB Server. +PHP has to have the `pdo_mysql` driver enabled. + +```sh +# start mariadb +cd ./backend/docker-test-env/ +docker compose up -d + +# start api +cd .. #./backend/ +php -S localhost:8000 + +# start frontend +# coming soon... +``` diff --git a/backend/docker-test-env/compose.yml b/backend/docker-test-env/compose.yml new file mode 100644 index 0000000..fd109f9 --- /dev/null +++ b/backend/docker-test-env/compose.yml @@ -0,0 +1,10 @@ +services: + db: + image: mariadb:11 + environment: + MARIADB_ROOT_PASSWORD: aA1234Aa + MARIADB_USER: db + MARIADB_PASSWORD: aA1234Aa + MARIADB_DATABASE: hitlerclicker + ports: + - 3306:3306 diff --git a/backend/index.php b/backend/index.php new file mode 100644 index 0000000..dead696 --- /dev/null +++ b/backend/index.php @@ -0,0 +1,17 @@ +prepare("CREATE TABLE IF NOT EXISTS `hitlerclicker`.`stats` ( `team` VARCHAR(256) NOT NULL DEFAULT uuid() , `clicks` INT(128) unsigned zerofill NOT NULL DEFAULT '0', PRIMARY KEY (`team`) ) ENGINE = InnoDB;"); +$query->execute(); +$query = $pdo->prepare("CREATE TABLE IF NOT EXISTS `hitlerclicker`.`users` ( `name` VARCHAR(256) NOT NULL DEFAULT uuid() , `password` VARCHAR(256) NOT NULL , `team` VARCHAR(256) NOT NULL DEFAULT 'axis' , `clicks` INT(128) unsigned zerofill NOT NULL DEFAULT '0', PRIMARY KEY (`name`) ) ENGINE = InnoDB;"); +$query->execute(); + +echo '{ "status": "online" }'; + +?> -- cgit v1.2.3