if( (isset($_POST['loginName'])) && isset($_POST['loginPassword'])){
$name = ($_POST['loginName']);
$pswd = ($_POST['loginPassword']);
$pswd = md5($pswd);
$stmt = $database->prepare("SELECT id, username FROM user WHERE '$name'=username AND password='$pswd'");
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows == 1) {
$object = $result->fetch_object();
$_SESSION['user'] = $object->id;
$_SESSION['username'] = $object->username;
// echo "Einloggen erfolgreich
Willkommen " . $_SESSION['username'];
// header("refresh:1;");
// header("location:index.php?page=myFriendsBook");
echo "";
} else {
echo "Einloggen fehlgeschlagen";
}
}
?>