Testing #16

Merged
PBG2H22AWO merged 10 commits from Testing into main 2024-01-26 10:34:22 +01:00
2 changed files with 35 additions and 0 deletions
Showing only changes of commit e730377103 - Show all commits

View File

@ -44,6 +44,13 @@ class BenutzerController
return json_encode($result); return json_encode($result);
} }
public function anmeldeVersuch($data)
{
$result = $this->db->anmeldeVersuch($data);
return json_encode($result);
}
} }
?> ?>

View File

@ -115,6 +115,34 @@ class BenutzerModel extends Database
return $result; return $result;
} }
public function anmeldeVersuch()
{
$pdo = $this->linkDB();
$params = array();
$params[":Benutzername"] = $_GET["Benutzername"];
$params[":passwort"] = $_GET["passwort"];
$sql = "SELECT * FROM Benutzerkonto WHERE name = :Benutzername AND passwort = :passwort";
try {
$stmt = $pdo->prepare($sql);
$stmt->execute($params);
} catch (\PDOException $e) {
return false;
}
$result = $stmt->fetchALL(\PDO::FETCH_ASSOC);
if (count($result) > 0)
return true;
else
return false;
}
} }
?> ?>