This commit is contained in:
Harald G. Mueller 2022-03-17 11:24:51 +01:00
parent bfd1a06c04
commit 171ca4d555
57 changed files with 0 additions and 953 deletions

View File

@ -1,30 +0,0 @@
<?php
include_once("model/Model.php");
class Controller {
public $model;
public function __construct()
{
$this->model = new Model();
}
public function invoke()
{
if (!isset($_GET['book']))
{
// no special book is requested, we'll show a list of all available books
$books = $this->model->getBookList();
include 'view/booklist.php';
}
else
{
// show the requested book
$book = $this->model->getBook($_GET['book']);
include 'view/viewbook.php';
}
}
}
?>

View File

@ -1,7 +0,0 @@
<?php
include_once("controller/Controller.php");
$controller = new Controller();
$controller->invoke();
?>

View File

@ -1,16 +0,0 @@
<?php
class Book {
public $title;
public $author;
public $description;
public function __construct($title, $author, $description)
{
$this->title = $title;
$this->author = $author;
$this->description = $description;
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
include_once("model/Book.php");
class Model {
public function getBookList()
{
// here goes some hardcoded values to simulate the database
return array(
"Jungle Book" => new Book("Jungle Book", "R. Kipling", "A classic book."),
"Moonwalker" => new Book("Moonwalker", "J. Walker", ""),
"PHP for Dummies" => new Book("PHP for Dummies", "Some Smart Guy", "")
);
}
public function getBook($title)
{
// we use the previous function to get all the books and then we return the requested one.
// in a real life scenario this will be done through a db select command
$allBooks = $this->getBookList();
return $allBooks[$title];
}
}
?>

View File

@ -1 +0,0 @@
Source code for Model View Controller Tutorial in PHP: http://php-html.net/tutorials/model-view-controller-in-php/

View File

@ -1,19 +0,0 @@
<html>
<head></head>
<body>
<table>
<tr><td>Title</td><td>Author</td><td>Description</td></tr>
<?php
foreach ($books as $title => $book)
{
echo '<tr><td><a href="index.php?book='.$book->title.'">'.$book->title.'</a></td><td>'.$book->author.'</td><td>'.$book->description.'</td></tr>';
}
?>
</table>
</body>
</html>

View File

@ -1,15 +0,0 @@
<html>
<head></head>
<body>
<?php
echo 'Title:' . $book->title . '<br/>';
echo 'Author:' . $book->author . '<br/>';
echo 'Description:' . $book->description . '<br/>';
?>
</body>
</html>

View File

@ -1,23 +0,0 @@
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Login Form</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<span href="#" class="button" id="toggle-login">Log in</span>
<div id="login">
<div id="triangle"></div>
<h1>Log in</h1>
<form action="control/anmeldung.php">
<input type="email" name="benutzer" placeholder="Email" />
<input type="password" name="password" placeholder="Password" />
<input type="submit" value="Log in" />
</form>
</div>
<script src="js/index.js"></script>
</body>
</html>

View File

@ -1,10 +0,0 @@
<?php
session_start();
unset($_SESSION['benutzer']) ;
unset($_SESSION['password']);
echo "Benutzer abgemeldet.";
?>

View File

@ -1,29 +0,0 @@
<?php
session_start();
$_SESSION['benutzer'] = $_REQUEST['benutzer'];
$_SESSION['password'] = $_REQUEST['password'];
// Prüfe Inhalt von Eingabe
if ((strlen($_SESSION['benutzer'])>0)and (strlen($_SESSION['password'])>0))
{
$html_Output = "<html><head><title>Anmeldung</title></head>";
$html_Output .= "<body>";
$html_Output .= "Hallo, ".$_SESSION["benutzer"]." die anmeldung war erfolgreich.";
$html_Output .= "<a href=../control/abmeldung.php>abmelden</a>";
$html_Output .= "</body></html>";
}
else
{
$html_Output = "<html><head><title>Anmeldung</title></head>";
$html_Output .= "<body>";
$html_Output .= "Hallo, die Anmeldung war nicht erfolgreich.";
$html_Output .= "</body></html>";
}
echo $html_Output;
?>

View File

@ -1,87 +0,0 @@
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300,400,700);
*{margin:0;padding:0;}
body{
background:#567;
font-family:'Open Sans',sans-serif;
}
.button{
width:100px;
background:#3399cc;
display:block;
margin:0 auto;
margin-top:1%;
padding:10px;
text-align:center;
text-decoration:none;
color:#fff;
cursor:pointer;
transition:background .3s;
-webkit-transition:background .3s;
}
.button:hover{
background:#2288bb;
}
#login{
width:400px;
margin:0 auto;
margin-top:8px;
margin-bottom:2%;
transition:opacity 1s;
-webkit-transition:opacity 1s;
}
#triangle{
width:0;
border-top:12x solid transparent;
border-right:12px solid transparent;
border-bottom:12px solid #3399cc;
border-left:12px solid transparent;
margin:0 auto;
}
#login h1{
background:#3399cc;
padding:20px 0;
font-size:140%;
font-weight:300;
text-align:center;
color:#fff;
}
form{
background:#f0f0f0;
padding:6% 4%;
}
input[type="email"],input[type="password"]{
width:92%;
background:#fff;
margin-bottom:4%;
border:1px solid #ccc;
padding:4%;
font-family:'Open Sans',sans-serif;
font-size:95%;
color:#555;
}
input[type="submit"]{
width:100%;
background:#3399cc;
border:0;
padding:4%;
font-family:'Open Sans',sans-serif;
font-size:100%;
color:#fff;
cursor:pointer;
transition:background .3s;
-webkit-transition:background .3s;
}
input[type="submit"]:hover{
background:#2288bb;
}

View File

@ -1,3 +0,0 @@
$('#toggle-login').click(function(){
$('#login').toggle();
});

View File

@ -1,30 +0,0 @@
<?php
include_once("model/Model.php");
class Controller {
public $model;
public function __construct()
{
$this->model = new Model();
}
public function invoke()
{
if (!isset($_GET['book']))
{
// no special book is requested, we'll show a list of all available books
$books = $this->model->getBookList();
include 'view/booklist.php';
}
else
{
// show the requested book
$book = $this->model->getBook($_GET['book']);
include 'view/viewbook.php';
}
}
}
?>

View File

@ -1,7 +0,0 @@
<?php
include_once("controller/Controller.php");
$controller = new Controller();
$controller->invoke();
?>

View File

@ -1,16 +0,0 @@
<?php
class Book {
public $title;
public $author;
public $description;
public function __construct($title, $author, $description)
{
$this->title = $title;
$this->author = $author;
$this->description = $description;
}
}
?>

View File

@ -1,27 +0,0 @@
<?php
include_once("model/Book.php");
class Model {
public function getBookList()
{
// here goes some hardcoded values to simulate the database
return array(
"Jungle Book" => new Book("Jungle Book", "R. Kipling", "A classic book."),
"Moonwalker" => new Book("Moonwalker", "J. Walker", ""),
"PHP for Dummies" => new Book("PHP for Dummies", "Some Smart Guy", "")
);
}
public function getBook($title)
{
// we use the previous function to get all the books and then we return the requested one.
// in a real life scenario this will be done through a db select command
$allBooks = $this->getBookList();
return $allBooks[$title];
}
}
?>

View File

@ -1,19 +0,0 @@
<html>
<head></head>
<body>
<table>
<tr><td>Title</td><td>Author</td><td>Description</td></tr>
<?php
foreach ($books as $title => $book)
{
echo '<tr><td><a href="index.php?book='.$book->title.'">'.$book->title.'</a></td><td>'.$book->author.'</td><td>'.$book->description.'</td></tr>';
}
?>
</table>
</body>
</html>

View File

@ -1,15 +0,0 @@
<html>
<head></head>
<body>
<?php
echo 'Title:' . $book->title . '<br/>';
echo 'Author:' . $book->author . '<br/>';
echo 'Description:' . $book->description . '<br/>';
?>
</body>
</html>

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Get Mitarbeiter Form</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="GetMitarbeiter">
<h1>Get Mitarbeiter</h1>
<form action="control/getmitarbeiter.php">
<input type="submit" value="Get Mitarbeiter" />
</form>
</div>
</body>
</html>

View File

@ -1,61 +0,0 @@
-- phpMyAdmin SQL Dump
-- version 4.1.6
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Erstellungszeit: 23. Nov 2015 um 20:31
-- Server Version: 5.6.16
-- PHP-Version: 5.5.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Datenbank: `test`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `tbl_personen`
--
CREATE TABLE IF NOT EXISTS `tbl_personen` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Nachname` varchar(50) NOT NULL,
`fk_hobby` int(11) NOT NULL,
`fk_firma` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_hobby` (`fk_hobby`),
KEY `fk_firma` (`fk_firma`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
--
-- Daten für Tabelle `tbl_personen`
--
INSERT INTO `tbl_personen` (`id`, `Nachname`, `fk_hobby`, `fk_firma`) VALUES
(1, 'Meier', 1, 7),
(6, 'Ulmer', 2, 8),
(7, 'Müller', 2, 7);
--
-- Constraints der exportierten Tabellen
--
--
-- Constraints der Tabelle `tbl_personen`
--
ALTER TABLE `tbl_personen`
ADD CONSTRAINT `tbl_personen_ibfk_1` FOREIGN KEY (`fk_hobby`) REFERENCES `tbl_hobbies` (`id`),
ADD CONSTRAINT `fk_tbl_personen_tbl_firmen1` FOREIGN KEY (`fk_firma`) REFERENCES `tbl_firmen` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@ -1,46 +0,0 @@
<?php
/*************************************************************/
/** Modul: 3-Tier Architektur (M-133) **/
/** Filename: getmitarbeiter.php **/
/** Author: VOM **/
/** Version: 1.0 **/
/** **/
/*************************************************************/
session_start();
include_once $_SERVER['DOCUMENT_ROOT'] . '/M_133/DB_Architektur/include/db_connection.inc';
// Erfolgreiche DB Verbindung prüfen
if ($_SESSION['DBConnection']['DBID']){
// SQL Query definieren
$sql = "select P.Nachname,F.Firmenname, H.Hobyname from tbl_personen P ";
$sql .="join tbl_firmen F on P.fk_firma = F.id ";
$sql .="join tbl_hobbies H on P.fk_hobby = H.id ";
$sql .="order by P.Nachname asc";
// Query ausführen
$result = mysql_query($sql);
$html_Output_InnerTable = "<table border='1' bgcolor='#999999'><tbody>";
// Recorset zuweisen
while ($row = mysql_fetch_array($result)) {
$html_Output_InnerTable .= "<tr><td>". $row[0]. "</td>";
$html_Output_InnerTable .= "<td>". $row[1]. "</td>";
$html_Output_InnerTable .= "<td>". $row[2]. "</td></tr>";
}
// Daten für Präsentation Layer vorbereiten
$html_Output_InnerTable .= "</tbody></table>";
$html_Output = "<html><head><title>Mitarbeiter Table</title></head>";
$html_Output .= "<h1>Mitarbeiter Tabelle</h1>";
$html_Output .= "<body>";
$html_Output .= $html_Output_InnerTable;
$html_Output .= "</body></html>";
// HTML an Präsentation Layer senden
echo $html_Output;
}
?>

View File

@ -1,61 +0,0 @@
*{margin:0;padding:0;}
body{
background:#567;
font-family:'Open Sans',sans-serif;
}
.button{
width:100px;
background:#3399cc;
display:block;
margin:0 auto;
margin-top:1%;
padding:10px;
text-align:center;
text-decoration:none;
color:#fff;
cursor:pointer;
transition:background .3s;
-webkit-transition:background .3s;
}
.button:hover{
background:#2288bb;
}
#GetMitarbeiter h1{
background:#3399cc;
padding:20px 0;
font-size:140%;
font-weight:300;
text-align:center;
color:#fff;
}
form{
background:#f0f0f0;
padding:6% 4%;
}
input[type="submit"]{
width:20%;
background:#3399cc;
border:0;
padding:4%;
font-family:'Open Sans',sans-serif;
font-size:100%;
color:#fff;
cursor:pointer;
transition:background .3s;
-webkit-transition:background .3s;
}
input[type="submit"]:hover{
background:#2288bb;
}

View File

@ -1,24 +0,0 @@
<?php
$user = "test";
$pass = "test";
$toReturn = "";
$DBName = "test";
$DBPassword = "";
$ServerName = "MySQLTest32";
// DB verbinden
$dblink = mysql_connect($ServerName,$user,$pass);
// DB auswaehlen
$db_selected = mysql_select_db($DBName, $dblink);
if (!$db_selected) {
die ('Kann foo nicht benutzen : ' . mysql_error());
}
else
{
$_SESSION['DBConnection']['ServerName'] = $ServerName;
$_SESSION['DBConnection']['DBID'] = $dblink;
}
?>

View File

@ -1,61 +0,0 @@
*{margin:0;padding:0;}
body{
background:#567;
font-family:'Open Sans',sans-serif;
}
.button{
width:100px;
background:#3399cc;
display:block;
margin:0 auto;
margin-top:1%;
padding:10px;
text-align:center;
text-decoration:none;
color:#fff;
cursor:pointer;
transition:background .3s;
-webkit-transition:background .3s;
}
.button:hover{
background:#2288bb;
}
#GetMitarbeiter h1{
background:#3399cc;
padding:20px 0;
font-size:140%;
font-weight:300;
text-align:center;
color:#fff;
}
form{
background:#f0f0f0;
padding:6% 4%;
}
input[type="submit"]{
width:20%;
background:#3399cc;
border:0;
padding:4%;
font-family:'Open Sans',sans-serif;
font-size:100%;
color:#fff;
cursor:pointer;
transition:background .3s;
-webkit-transition:background .3s;
}
input[type="submit"]:hover{
background:#2288bb;
}

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Get Mitarbeiter Form</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="GetMitarbeiter">
<h1>Get Mitarbeiter</h1>
<form action="./control/getmitarbeiter.php">
<input type="submit" value="Get Mitarbeiter" />
</form>
</div>
</body>
</html>

View File

@ -1,24 +0,0 @@
<?php
$user = "test";
$pass = "test";
$toReturn = "";
$DBName = "test";
$DBPassword = "";
$ServerName = "MySQLTest32";
// DB verbinden
$dblink = mysql_connect($ServerName,$user,$pass);
// DB auswaehlen
$db_selected = mysql_select_db($DBName, $dblink);
if (!$db_selected) {
die ('Kann foo nicht benutzen : ' . mysql_error());
}
else
{
$_SESSION['DBConnection']['ServerName'] = $ServerName;
$_SESSION['DBConnection']['DBID'] = $dblink;
}
?>

View File

@ -1,46 +0,0 @@
<?php
/*************************************************************/
/** Modul: 3-Tier Architektur (M-133) **/
/** Filename: getmitarbeiter.php **/
/** Author: VOM **/
/** Version: 1.0 **/
/** **/
/*************************************************************/
session_start();
include_once $_SERVER['DOCUMENT_ROOT'] . '/M_133/DB_Architektur/include/db_connection.inc';
// Erfolgreiche DB Verbindung prüfen
if ($_SESSION['DBConnection']['DBID']){
// SQL Query definieren
$sql = "select P.Nachname,F.Firmenname, H.Hobyname from tbl_personen P ";
$sql .="join tbl_firmen F on P.fk_firma = F.id ";
$sql .="join tbl_hobbies H on P.fk_hobby = H.id ";
$sql .="order by P.Nachname asc";
// Query ausführen
$result = mysql_query($sql);
$html_Output_InnerTable = "<table border='1' bgcolor='#999999'><tbody>";
// Recorset zuweisen
while ($row = mysql_fetch_array($result)) {
$html_Output_InnerTable .= "<tr><td>". $row[0]. "</td>";
$html_Output_InnerTable .= "<td>". $row[1]. "</td>";
$html_Output_InnerTable .= "<td>". $row[2]. "</td></tr>";
}
// Daten für Präsentation Layer vorbereiten
$html_Output_InnerTable .= "</tbody></table>";
$html_Output = "<html><head><title>Mitarbeiter Table</title></head>";
$html_Output .= "<h1>Mitarbeiter Tabelle</h1>";
$html_Output .= "<body>";
$html_Output .= $html_Output_InnerTable;
$html_Output .= "</body></html>";
// HTML an Präsentation Layer senden
echo $html_Output;
}
?>

View File

@ -1,61 +0,0 @@
-- phpMyAdmin SQL Dump
-- version 4.1.6
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Erstellungszeit: 23. Nov 2015 um 20:31
-- Server Version: 5.6.16
-- PHP-Version: 5.5.9
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Datenbank: `test`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `tbl_personen`
--
CREATE TABLE IF NOT EXISTS `tbl_personen` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Nachname` varchar(50) NOT NULL,
`fk_hobby` int(11) NOT NULL,
`fk_firma` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_hobby` (`fk_hobby`),
KEY `fk_firma` (`fk_firma`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
--
-- Daten für Tabelle `tbl_personen`
--
INSERT INTO `tbl_personen` (`id`, `Nachname`, `fk_hobby`, `fk_firma`) VALUES
(1, 'Meier', 1, 7),
(6, 'Ulmer', 2, 8),
(7, 'Müller', 2, 7);
--
-- Constraints der exportierten Tabellen
--
--
-- Constraints der Tabelle `tbl_personen`
--
ALTER TABLE `tbl_personen`
ADD CONSTRAINT `tbl_personen_ibfk_1` FOREIGN KEY (`fk_hobby`) REFERENCES `tbl_hobbies` (`id`),
ADD CONSTRAINT `fk_tbl_personen_tbl_firmen1` FOREIGN KEY (`fk_firma`) REFERENCES `tbl_firmen` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

View File

@ -1,87 +0,0 @@
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300,400,700);
*{margin:0;padding:0;}
body{
background:#567;
font-family:'Open Sans',sans-serif;
}
.button{
width:100px;
background:#3399cc;
display:block;
margin:0 auto;
margin-top:1%;
padding:10px;
text-align:center;
text-decoration:none;
color:#fff;
cursor:pointer;
transition:background .3s;
-webkit-transition:background .3s;
}
.button:hover{
background:#2288bb;
}
#login{
width:400px;
margin:0 auto;
margin-top:8px;
margin-bottom:2%;
transition:opacity 1s;
-webkit-transition:opacity 1s;
}
#triangle{
width:0;
border-top:12x solid transparent;
border-right:12px solid transparent;
border-bottom:12px solid #3399cc;
border-left:12px solid transparent;
margin:0 auto;
}
#login h1{
background:#3399cc;
padding:20px 0;
font-size:140%;
font-weight:300;
text-align:center;
color:#fff;
}
form{
background:#f0f0f0;
padding:6% 4%;
}
input[type="email"],input[type="password"]{
width:92%;
background:#fff;
margin-bottom:4%;
border:1px solid #ccc;
padding:4%;
font-family:'Open Sans',sans-serif;
font-size:95%;
color:#555;
}
input[type="submit"]{
width:100%;
background:#3399cc;
border:0;
padding:4%;
font-family:'Open Sans',sans-serif;
font-size:100%;
color:#fff;
cursor:pointer;
transition:background .3s;
-webkit-transition:background .3s;
}
input[type="submit"]:hover{
background:#2288bb;
}

View File

@ -1,3 +0,0 @@
$('#toggle-login').click(function(){
$('#login').toggle();
});

View File

@ -1,23 +0,0 @@
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>Login Form</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<span href="#" class="button" id="toggle-login">Log in</span>
<div id="login">
<div id="triangle"></div>
<h1>Log in</h1>
<form action="./control/anmeldung.php">
<input type="email" name="benutzer" placeholder="Email" />
<input type="password" name="password" placeholder="Password" />
<input type="submit" value="Log in" />
</form>
</div>
<script src="js/index.js"></script>
</body>
</html>

View File

@ -1,10 +0,0 @@
<?php
session_start();
unset($_SESSION['benutzer']) ;
unset($_SESSION['password']);
echo "Benutzer abgemeldet.";
?>

View File

@ -1,29 +0,0 @@
<?php
session_start();
$_SESSION['benutzer'] = $_REQUEST['benutzer'];
$_SESSION['password'] = $_REQUEST['password'];
// Prüfe Inhalt von Eingabe
if ((strlen($_SESSION['benutzer'])>0)and (strlen($_SESSION['password'])>0))
{
$html_Output = "<html><head><title>Anmeldung</title></head>";
$html_Output .= "<body>";
$html_Output .= "Hallo, ".$_SESSION["benutzer"]." die anmeldung war erfolgreich.";
$html_Output .= "<a href=../control/abmeldung.php>abmelden</a>";
$html_Output .= "</body></html>";
}
else
{
$html_Output = "<html><head><title>Anmeldung</title></head>";
$html_Output .= "<body>";
$html_Output .= "Hallo, die Anmeldung war nicht erfolgreich.";
$html_Output .= "</body></html>";
}
echo $html_Output;
?>