Fehler und Ausnahmekonzept

This commit is contained in:
2026-05-05 09:27:45 +00:00
parent 0556dec11d
commit 4fac3121f3
5 changed files with 31 additions and 17 deletions
+19 -5
View File
@@ -11,6 +11,8 @@ setcookie("Image2Food", time(), time() + (60 * 60 * 24 * 120));
if (0 > version_compare(PHP_VERSION, '7')) {
die('<h1>Für diese Anwendung ' . 'ist mindestens PHP 7 notwendig');
}
class MeineAusnahme extends Exception{};
?>
@@ -25,12 +27,24 @@ if (0 > version_compare(PHP_VERSION, '7')) {
<div id="nav">
<?php
if (isset($_SESSION["login"]) && ($_SESSION["login"] == "true")) {
require ("navmitglieder.php");
try {
if (isset($_SESSION["login"]) && ($_SESSION["login"] == "true")) {
if (@include("navmitglieder.php"));{
throw new MeineAusnahme();
}
}
else {
if (@include("nav.php"));{
throw new MeineAusnahme();
}
}
} catch (MeineAusnahme $e) {
die("<h1>Image2Food - Sag mir was ich daraus kochen kann</h1>
<h2>Das soziale, multimediale Netzwerk für Kochideen</h2>
<p> Leider gibt es ein Problem mit der Webseite.
Wir arbeiten daran mit Hochdruck. Besuchen Sie uns in kürze wieder enu</p>");
}
else {
require("nav.php");
}
?>
</div>
<div id="content">
+4 -4
View File
@@ -21,14 +21,14 @@ session_start();
<body>
<div id="nav">
<?php
require("nav.php");
require("plausi.inc.php")
@include("nav.php");
@include("plausi.inc.php")
?>
</div>
<div id="content">
<h1>Login</h1>
<?php
require("login.inc.php");
@include("login.inc.php");
/**
* Das soziale Netzwerk für Kochideen
* die Loginseite
@@ -69,7 +69,7 @@ session_start();
private function anmelden_db() {
$vorhanden = false;
require("db.inc.php");
@include("db.inc.php");
if ($stmt = $pdo->prepare("SELECT userid, pw FROM mitglieder"))
{
$stmt -> execute();
+2 -2
View File
@@ -14,11 +14,11 @@ if (0 > version_compare(PHP_VERSION, '7')) {
<title>Image2Food - Sag mir was ich daraus kochen kann - Index</title>
</head>
<body>
<div id="nav"> <?php require("nav.php") ?></div>
<div id="nav"> <?php @include("nav.php") ?></div>
<div id="content">
<h1>Anmeldefehler</h1>
<?php
require("login.inc.php");
@include("login.inc.php");
class LoginFehler {
public function fehler() {
+2 -2
View File
@@ -13,11 +13,11 @@ if (0 > version_compare(PHP_VERSION, '7')) {
<title>Image2Food - Sag mir was ich daraus kochen kann - Index</title>
</head>
<body>
<div id="nav"> <?php require("nav.php") ?></div>
<div id="nav"> <?php @include("nav.php") ?></div>
<div id="content">
<h1>Registrierungsfehler</h1>
<?php
require ("registrieren.inc.php");
@include ("registrieren.inc.php");
class RegFehler {
public function fehler() {
echo "<h4>Die Registrierung hat leider nicht funktioniert</h4>". "<h5>Wählen Sie eine andere Userid und versuchen Sie es erneut.</h5>";
+4 -4
View File
@@ -21,14 +21,14 @@ if (0 > version_compare(PHP_VERSION, '7')) {
<body>
<div id="nav">
<?php
require("nav.php");
require("plausi.inc.php");
@include("nav.php");
@include("plausi.inc.php");
?>
</div>
<div id="content">
<h1>Registrierung</h1>
<?php
require("registrieren.inc.php");
@include("registrieren.inc.php");
/**
* Das soziale Netzwerk für Kochideen die registrierungsseite
*/
@@ -82,7 +82,7 @@ if (0 > version_compare(PHP_VERSION, '7')) {
*/
private function eintragen_db() {
require ("db.inc.php");
@include ("db.inc.php");
try {
$stmt = $pdo->prepare("INSERT INTO mitglieder (
name, vorname, email, zusatzinfos, rolle, userid, pw)