Webseite ohne Anmeldung läuft auf laravel
This commit is contained in:
80
M6/emensamobile/app/Http/Controllers/AnmeldungController.php
Normal file
80
M6/emensamobile/app/Http/Controllers/AnmeldungController.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use App\Models\Benutzer;
|
||||
use RequestData;
|
||||
|
||||
|
||||
class AnmeldungController extends BaseController
|
||||
{
|
||||
|
||||
public function start(){
|
||||
return view(
|
||||
'm5_a1.anmeldung',
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
public function anmeldung_verifizieren(RequestData $rd){
|
||||
|
||||
$data = $rd->getPostData();
|
||||
|
||||
$email = $data["email"] ?? NULL;
|
||||
$passwort = $data["passwort"] ?? NULL;
|
||||
|
||||
$benutzer = new Benutzer();
|
||||
$anmeldung = $benutzer.anmelden($email, sha1($passwort));
|
||||
|
||||
if($anmeldung){
|
||||
|
||||
$log = logger('anmeldung', '../storage/logs');
|
||||
$log->info('Anmeldung erfolgreich!');
|
||||
}
|
||||
else{
|
||||
|
||||
$log = logger('anmeldung', '../storage/logs');
|
||||
$log->warning('Anmeldung fehlgeschlagen!');
|
||||
}
|
||||
|
||||
return view(
|
||||
'm5_a1.anmeldung_verifizieren',
|
||||
[
|
||||
'email' => $email,
|
||||
'passwort' => $passwort,
|
||||
'anmeldung' => $anmeldung
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function check(RequestData $rd){
|
||||
|
||||
$data = $rd->getPostData();
|
||||
|
||||
$email = $data["email"] ?? NULL;
|
||||
$passwort = $data["passwort"] ?? NULL;
|
||||
$anmeldung = $data["anmeldung"] ?? NULL;
|
||||
|
||||
return view(
|
||||
'm5_a1.anmeldung',
|
||||
[
|
||||
'email' => $email,
|
||||
'passwort' => $passwort,
|
||||
'anmeldung' => $anmeldung,
|
||||
'data' => $data
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function abmelden(){
|
||||
|
||||
session_unset();
|
||||
session_destroy();
|
||||
|
||||
$log = logger('anmeldung', '../storage/logs');
|
||||
$log->info('Abmeldung erfolgreich!');
|
||||
|
||||
return view('m5_a1.abmeldung', []);
|
||||
}
|
||||
}
|
||||
12
M6/emensamobile/app/Http/Controllers/Controller.php
Normal file
12
M6/emensamobile/app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, ValidatesRequests;
|
||||
}
|
||||
27
M6/emensamobile/app/Http/Controllers/MainController.php
Normal file
27
M6/emensamobile/app/Http/Controllers/MainController.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use App\Models\Gerichte;
|
||||
|
||||
|
||||
class MainController extends BaseController
|
||||
{
|
||||
public function index() {
|
||||
/*
|
||||
Wenn Sie hier landen:
|
||||
bearbeiten Sie diese Action,
|
||||
so dass Sie die Aufgabe löst
|
||||
*/
|
||||
|
||||
|
||||
$gericht = new Gerichte();
|
||||
$data = $gericht->db_gericht_select_karte();
|
||||
|
||||
return view('main.index', [
|
||||
'data'=>$data,
|
||||
'url' => 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user