refactored the reading functions for playerData, because of problems on other test machines. Added DatabaseDump to repo.
This commit is contained in:
parent
8daaeacd2b
commit
26ed07ba42
4 changed files with 80 additions and 9 deletions
60
MatheApp.sql
Normal file
60
MatheApp.sql
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
-- MariaDB dump 10.19 Distrib 10.6.11-MariaDB, for debian-linux-gnu (x86_64)
|
||||||
|
--
|
||||||
|
-- Host: localhost Database: MatheApp
|
||||||
|
-- ------------------------------------------------------
|
||||||
|
-- Server version 10.6.11-MariaDB-0ubuntu0.22.04.1
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8mb4 */;
|
||||||
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||||
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||||
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `user`
|
||||||
|
--
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `user`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `user` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`username` varchar(255) NOT NULL,
|
||||||
|
`vorname` varchar(255) NOT NULL,
|
||||||
|
`nachname` varchar(255) NOT NULL,
|
||||||
|
`email` varchar(255) NOT NULL,
|
||||||
|
`password` varchar(255) NOT NULL,
|
||||||
|
`lesson_count` int(11) NOT NULL,
|
||||||
|
`level` int(11) NOT NULL,
|
||||||
|
`xp` int(11) NOT NULL,
|
||||||
|
`coins` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `reference_unique` (`username`,`email`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Dumping data for table `user`
|
||||||
|
--
|
||||||
|
|
||||||
|
LOCK TABLES `user` WRITE;
|
||||||
|
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
|
||||||
|
INSERT INTO `user` VALUES (3,'patryk','patryk','hegenberg','testMail@test.de','$2y$10$G8s3UA8zMjHnKAQ01B4.R.NX7gLZi28BuQiOVyBbnbYbNCZusx13W',1,1,17,43);
|
||||||
|
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||||
|
|
||||||
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||||
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
|
-- Dump completed on 2023-01-11 13:29:50
|
||||||
|
|
@ -1,11 +1,22 @@
|
||||||
(function (w) {
|
(function (w) {
|
||||||
var playerStats = document.getElementById("playerStats").innerHTML;
|
var playerStats = document.getElementById("playerStats").innerHTML;
|
||||||
playerStats = playerStats.replace("'","").replace("{","").replace("}", "").split(",");
|
|
||||||
statsOfPlayer = {};
|
function convertData(stats) {
|
||||||
for (var i = 0; i < playerStats.length; i++) {
|
var player = {};
|
||||||
var parts = playerStats[i].split(":")
|
stats = stats.replace("'", "").replace("{","").replace("}","");
|
||||||
statsOfPlayer[parts[0].trim().replace("'","").replace('"','').replace('"','')] = parts[1].trim().replace("'","");
|
stats = stats.split(",");
|
||||||
|
for (let i = 0; i < stats.length; i++) {
|
||||||
|
var parts = stats[i].split(":");
|
||||||
|
if (isNaN(Number(parts[1].replace("'","").replace('"','').replace('"','')))) {
|
||||||
|
player[parts[0].replace("'","").replace('"','').replace('"','')] = parts[1].replace("'","").replace('"','').replace('"','');
|
||||||
|
} else {
|
||||||
|
player[parts[0].replace("'","").replace('"','').replace('"','')] = Number(parts[1].replace("'","").replace('"','').replace('"',''));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var statsOfPlayer = convertData(playerStats);
|
||||||
let count = 1;
|
let count = 1;
|
||||||
// game title
|
// game title
|
||||||
const gametitle = "The Math Wizard";
|
const gametitle = "The Math Wizard";
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<?php require ('partials/nav.php') ?>
|
<?php require ('partials/nav.php') ?>
|
||||||
<div class="isolate bg-white my-10">
|
<div class="isolate bg-white my-10">
|
||||||
<main style="background-color: #3f3035;">
|
<main style="background-color: #3f3035;">
|
||||||
<div class="relative px-6 lg:px-8 min-h-screen" style="background-image: url(../images/HeroBanner.png); background-repeat: no-repeat; background-position: center;">
|
<div class="relative px-6 lg:px-8 min-h-500" style="background-image: url(../images/HeroBanner.png); background-repeat: no-repeat; background-position: center;">
|
||||||
<div class="mx-auto max-w-3xl pt-20 pb-32 sm:pt-48 sm:pb-40">
|
<div class="mx-auto max-w-3xl pt-20 pb-32 sm:pt-48 sm:pb-40">
|
||||||
<div>
|
<div>
|
||||||
<div class="hidden sm:mb-8 sm:flex sm:justify-center">
|
<div class="hidden sm:mb-8 sm:flex sm:justify-center">
|
||||||
|
|
@ -33,10 +33,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="h-48" style="background-color: #3f3035;">
|
<div class="h-24" style="background-color: #3f3035;">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-white py-24 sm:py-32 lg:py-40">
|
<div class="py-24 sm:py-32 lg:py-40" style="background-color: #3f3035;">
|
||||||
<div class="nes-container with-title mx-auto max-w-7xl px-6 lg:px-8 bg-gray-50">
|
<div class="nes-container with-title mx-auto max-w-7xl px-6 lg:px-8 bg-gray-50">
|
||||||
<p class="title">Features</p>
|
<p class="title">Features</p>
|
||||||
<div class="sm:text-center">
|
<div class="sm:text-center">
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<a href="/logout" class="<?= urlIs("/logout") ?> nes-btn text-sm">Abmelden</a>
|
<a href="/logout" class="<?= urlIs("/logout") ?> nes-btn text-sm">Abmelden</a>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<a href="/login" class="<?= urlIs('/login') ?> nes-btn text-sm">Anmelden</a>
|
<a href="/login" class="<?= urlIs('/login') ?> nes-btn text-sm">Anmelden</a>
|
||||||
<a href="/register" class="<?= urlIs('/register') ?> nes-btn text-sm">Registrieren</a>
|
<!-- <a href="/register" class="<?= urlIs('/register') ?> nes-btn text-sm">Registrieren</a>-->
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue