implemented class method for login, register, update, delete and implemented readDatabase functionality to game.js. Write funtionality is in preogress
This commit is contained in:
parent
fbb52f76c0
commit
03e5591e0a
13 changed files with 145 additions and 83 deletions
|
|
@ -6,26 +6,7 @@ $config = require('config.php');
|
|||
$db = new Database($config['database'], $username, $password);
|
||||
|
||||
if (isset($_POST["submit"])) {
|
||||
$stmt = $db->query("SELECT * FROM user WHERE username = :user", ['user' => $_POST["username"]])->get();
|
||||
$count = sizeof($stmt);
|
||||
if ($count == 1) {
|
||||
$stmt = $stmt[0];;
|
||||
|
||||
if (password_verify($_POST['password'], $stmt["password"])) {
|
||||
session_start();
|
||||
$_SESSION["username"] = $stmt['username'];
|
||||
$_SESSION["level"] = $stmt['level'];
|
||||
$_SESSION["xp"] = $stmt['xp'];
|
||||
$_SESSION["coins"] = $stmt['coins'];
|
||||
$_SESSION["lesson_count"] = $stmt['lesson_count'];
|
||||
|
||||
header("Location: /profile");
|
||||
} else {
|
||||
echo "Anmeldung fehlgeschlagen!";
|
||||
}
|
||||
} else {
|
||||
echo "Anmeldung fehlgeschlagen!";
|
||||
}
|
||||
$db->login([$_POST["username"], $_POST["password"]]);
|
||||
}
|
||||
|
||||
require "views/login.view.php";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue