M5 A1 fertig
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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(); ?>
|
||||
|
||||
@@ -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); ?>>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
@elseif ($anmeldung == 1)
|
||||
{{ session_start() }}
|
||||
Anmeldung erlaubt!
|
||||
@else Anmeldung nicht erlaubt!
|
||||
@else Es ist ein Fehler aufgetretten!
|
||||
@endif
|
||||
|
||||
@endsection
|
||||
23
M5/emensa/views/m5_a1/anmeldung_nichtkorrekt.blade.php
Normal file
23
M5/emensa/views/m5_a1/anmeldung_nichtkorrekt.blade.php
Normal 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
|
||||
@@ -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 }}>
|
||||
|
||||
Reference in New Issue
Block a user