MyFirstAnmeldeFunktion
This commit is contained in:
		| @@ -44,6 +44,13 @@ class BenutzerController | ||||
|         return json_encode($result); | ||||
|     } | ||||
|  | ||||
|     public function anmeldeVersuch($data) | ||||
|     { | ||||
|         $result = $this->db->anmeldeVersuch($data); | ||||
|  | ||||
|         return json_encode($result); | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| ?> | ||||
| @@ -115,6 +115,34 @@ class BenutzerModel extends Database | ||||
|         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; | ||||
|  | ||||
|     } | ||||
| } | ||||
|  | ||||
| ?> | ||||
		Reference in New Issue
	
	Block a user