From fd50796b4e780a6488a9b27c1e5f8fe248ad0e17 Mon Sep 17 00:00:00 2001 From: Benjamin Kraft Date: Sat, 1 Jun 2024 13:39:29 +0200 Subject: [PATCH] start --- public/elotracker/index.php | 16 ++++++++++++ public/elotracker/styles.css | 0 public/index.php | 11 ++++++++ public/styles.css | 0 public/util/dotenv.php | 4 +++ public/util/mysql_connect.php | 47 +++++++++++++++++++++++++++++++++++ public/util/phpinfo.php | 2 ++ 7 files changed, 80 insertions(+) create mode 100644 public/elotracker/index.php create mode 100644 public/elotracker/styles.css create mode 100644 public/index.php create mode 100644 public/styles.css create mode 100644 public/util/dotenv.php create mode 100644 public/util/mysql_connect.php create mode 100644 public/util/phpinfo.php diff --git a/public/elotracker/index.php b/public/elotracker/index.php new file mode 100644 index 0000000..744956e --- /dev/null +++ b/public/elotracker/index.php @@ -0,0 +1,16 @@ + + + + + + UEM Elo Tracker + + + + + + diff --git a/public/elotracker/styles.css b/public/elotracker/styles.css new file mode 100644 index 0000000..e69de29 diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..2cf3f64 --- /dev/null +++ b/public/index.php @@ -0,0 +1,11 @@ + + + + + + University eSports Mainz + + +Zum Elo Tracker + + \ No newline at end of file diff --git a/public/styles.css b/public/styles.css new file mode 100644 index 0000000..e69de29 diff --git a/public/util/dotenv.php b/public/util/dotenv.php new file mode 100644 index 0000000..d435df8 --- /dev/null +++ b/public/util/dotenv.php @@ -0,0 +1,4 @@ + $value) + putenv("$key=$value"); diff --git a/public/util/mysql_connect.php b/public/util/mysql_connect.php new file mode 100644 index 0000000..148f4e5 --- /dev/null +++ b/public/util/mysql_connect.php @@ -0,0 +1,47 @@ +host = 'localhost'; + $this->port = intval(getenv('MYSQL_PORT')); + $this->user = getenv('MYSQL_USER'); + $this->pass = getenv('MYSQL_PASSWORD'); + $this->createConn(); + } + + private function createConn(): void { + $this->mysqli = new mysqli($this->host . ":" . $this->port, $this->user, $this->pass, $this->dbName); + } + + public function query($sql): mysqli_result|bool { + return $this->mysqli->query($sql); + } + + public function prepare($sql): bool|mysqli_stmt { + return $this->mysqli->prepare($sql); + } + + public function changeDB($dbName): void { + $this->dbName = $dbName; + $this->mysqli->select_db($dbName); + } + + public function escape(string $string): string{ + return $this->mysqli->real_escape_string($string); + } + + public function __destruct() { + $this->mysqli->close(); + } + +} \ No newline at end of file diff --git a/public/util/phpinfo.php b/public/util/phpinfo.php new file mode 100644 index 0000000..58ef35c --- /dev/null +++ b/public/util/phpinfo.php @@ -0,0 +1,2 @@ +