MyFirstAnmeldeFunktion

This commit is contained in:
Samuel Wolff 2024-01-18 09:31:09 +01:00
parent add9a27630
commit e730377103
2 changed files with 35 additions and 0 deletions

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;
}
} }
?> ?>