Webseite ohne Anmeldung läuft auf laravel
This commit is contained in:
75
M6/emensa/controllers/AnmeldungController.php
Normal file
75
M6/emensa/controllers/AnmeldungController.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/benutzer.php');
|
||||
|
||||
|
||||
class AnmeldungController
|
||||
{
|
||||
|
||||
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;
|
||||
|
||||
$anmeldung = 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', []);
|
||||
}
|
||||
}
|
||||
36
M6/emensa/controllers/DemoController.php
Normal file
36
M6/emensa/controllers/DemoController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/gericht.php');
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/kategorie.php');
|
||||
|
||||
class DemoController
|
||||
{
|
||||
public function dbconnect() {
|
||||
$data = db_gericht_select_all();
|
||||
// Frage Daten aus kategorie ab:
|
||||
// $data = db_kategorie_select_all();
|
||||
return view('demo.dbdata', ['data' => $data]);
|
||||
}
|
||||
|
||||
public function demo(RequestData $rd) {
|
||||
$vars = [
|
||||
'bgcolor' => $rd->query['bgcolor'] ?? 'ffffff',
|
||||
'name' => $rd->query['name'] ?? 'Dich',
|
||||
'rd' => $rd
|
||||
];
|
||||
return view('demo.demo', $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* error action for debug purposes
|
||||
* @throws Exception
|
||||
* @noinspection PhpUnusedLocalVariableInspection
|
||||
*/
|
||||
public function error(RequestData $rd) {
|
||||
$test = $rd;
|
||||
throw new Exception("Not implemented");
|
||||
}
|
||||
|
||||
public function requestdata(RequestData $rd) {
|
||||
return view('demo.requestdata', ['rd' => $rd]);
|
||||
}
|
||||
}
|
||||
47
M6/emensa/controllers/ExampleController.php
Normal file
47
M6/emensa/controllers/ExampleController.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/kategorie.php');
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/gerichte_self.php');
|
||||
|
||||
class ExampleController
|
||||
{
|
||||
public function m4_6a_queryparameter(RequestData $rd) {
|
||||
/*
|
||||
Wenn Sie hier landen:
|
||||
bearbeiten Sie diese Action,
|
||||
so dass Sie die Aufgabe löst
|
||||
*/
|
||||
$rd = $rd->query['name'] ?? 'Kein Name angegeben';
|
||||
|
||||
return view('examples.m4_7a_queryparameter', [
|
||||
'request'=>$rd,
|
||||
'url' => 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function m4_7b_kategorie() {
|
||||
$data = db_kategorie_select_all();
|
||||
|
||||
return view('examples.m4_7b_kategorie', [
|
||||
'data'=>$data,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function m4_7c_gerichte() {
|
||||
$data = db_gericht_select_intern();
|
||||
|
||||
return view('examples.m4_7c_gerichte', [
|
||||
'data'=>$data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function m4_7d(RequestData $rd) {
|
||||
|
||||
$rd = $rd->query['no'] ?? 1;
|
||||
if ($rd == 1)
|
||||
return view('examples.pages.m4_7d_page_1', []);
|
||||
elseif ($rd == 2)
|
||||
return view('examples.pages.m4_7d_page_2', []);
|
||||
}
|
||||
}
|
||||
14
M6/emensa/controllers/HomeController.php
Normal file
14
M6/emensa/controllers/HomeController.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/gericht.php');
|
||||
|
||||
/* Datei: controllers/HomeController.php */
|
||||
class HomeController
|
||||
{
|
||||
public function index(RequestData $request) {
|
||||
return view('home', ['rd' => $request ]);
|
||||
}
|
||||
|
||||
public function debug(RequestData $request) {
|
||||
return view('debug');
|
||||
}
|
||||
}
|
||||
23
M6/emensa/controllers/MainController.php
Normal file
23
M6/emensa/controllers/MainController.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/gerichte_main.php');
|
||||
|
||||
class MainController
|
||||
{
|
||||
public function index() {
|
||||
/*
|
||||
Wenn Sie hier landen:
|
||||
bearbeiten Sie diese Action,
|
||||
so dass Sie die Aufgabe löst
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$data = 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