M5 A1 fertig

This commit is contained in:
S170H
2023-12-19 16:13:37 +01:00
parent 4ed0518f1b
commit aa921725c9
7 changed files with 35 additions and 14 deletions

View File

@@ -13,15 +13,14 @@ function anmelden(string $email, string $passwort)
if ($row['passwort'] == NULL) {
$row = 0;
}
elseif ($row['passwort'] == $passwort) {
} elseif ($row['passwort'] == $passwort) {
session_start();
mysqli_begin_transaction($link);
$sql = "UPDATE benutzer SET letzteanmeldung = current_time, anzahlfehler = 0 WHERE email = '$email'";
$link->query($sql);
$sql = "UPDATE benutzer SET anzahlanmeldungen = anzahlanmeldungen + 1 WHERE id = ".$row['id'];
$sql = "UPDATE benutzer SET anzahlanmeldungen = anzahlanmeldungen + 1 WHERE id = " . $row['id'];
$link->query($sql);
mysqli_commit($link);
@@ -31,8 +30,7 @@ function anmelden(string $email, string $passwort)
$_SESSION['name'] = $row['name'];
$_SESSION['email'] = $row['email'];
return 1;
}
else {
} else {
mysqli_begin_transaction($link);

View File

@@ -23,6 +23,6 @@ return array(
'/anmeldung' => 'AnmeldungController@start',
'/anmeldung_verifizieren' => 'AnmeldungController@anmeldung_verifizieren',
'/anmeldung_nichtkorrekt' => 'AnmeldungController@check',
'/anmeldung_fehler' => 'AnmeldungController@check',
'/abmeldung' => 'AnmeldungController@abmelden'
);

View File

@@ -18,7 +18,7 @@
<?php echo \htmlentities(session_start()??'', ENT_QUOTES, 'UTF-8', false); ?>
Anmeldung erlaubt!
<?php else: ?> Anmeldung nicht erlaubt!
<?php else: ?> Es ist ein Fehler aufgetretten!
<?php endif; ?>
<?php $this->stopSection(); ?>

View File

@@ -3,8 +3,8 @@
<?php $this->startSection("main"); ?>
<?php if($anmeldung == 1): ?>
<meta http-equiv="refresh" content="/main"/>
<form id="form_ok" action="/main"></form>
<meta http-equiv="refresh" content="/"/>
<form id="form_ok" action="/"></form>
<script type="text/javascript">
@@ -22,7 +22,7 @@
</script>
<?php else: ?>
<form method="post" id="auto_form" action="/anmeldung_nichtkorrekt">
<form method="post" id="auto_form" action="/anmeldung_fehler">
<input type="hidden" name="email" value=<?php echo \htmlentities($email??'', ENT_QUOTES, 'UTF-8', false); ?>>
<input type="hidden" name="passwort" value=<?php echo \htmlentities($passwort??'', ENT_QUOTES, 'UTF-8', false); ?>>
<input type="hidden" name="anmeldung" value=<?php echo \htmlentities($anmeldung??'', ENT_QUOTES, 'UTF-8', false); ?>>

View File

@@ -17,7 +17,7 @@
@elseif ($anmeldung == 1)
{{ session_start() }}
Anmeldung erlaubt!
@else Anmeldung nicht erlaubt!
@else Es ist ein Fehler aufgetretten!
@endif
@endsection

View File

@@ -0,0 +1,23 @@
@extends("m5_a1.layout_anmeldung")
@section("main")
<form action="/anmeldung_verifizieren" method="post">
<label for="email">E-Mail</label>
<input id="email" name="email" type="email" placeholder="email" required maxlength="100">
<label for="passwort">Passwort</label>
<input id="passwort" name="passwort" type="password" placeholder="passwort" required maxlength="200">
<button type="submit" >Anmelden</button>
</form>
@if(!isset($anmeldung)) Bitte anmelden!
@elseif ($anmeldung == 1)
{{ session_start() }}
Anmeldung erlaubt!
@else Es ist ein Fehler aufgetretten!
@endif
@endsection

View File

@@ -3,8 +3,8 @@
@section("main")
@if($anmeldung == 1)
<meta http-equiv="refresh" content="/main"/>
<form id="form_ok" action="/main"></form>
<meta http-equiv="refresh" content="/"/>
<form id="form_ok" action="/"></form>
<script type="text/javascript">
@@ -22,7 +22,7 @@
</script>
@else
<form method="post" id="auto_form" action="/anmeldung_nichtkorrekt">
<form method="post" id="auto_form" action="/anmeldung_fehler">
<input type="hidden" name="email" value={{ $email}}>
<input type="hidden" name="passwort" value={{$passwort}}>
<input type="hidden" name="anmeldung" value={{$anmeldung }}>