erstmaliges Hochladen
This commit is contained in:
commit
764dc56beb
10 changed files with 544 additions and 0 deletions
22
.gitattributes
vendored
Normal file
22
.gitattributes
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
215
.gitignore
vendored
Normal file
215
.gitignore
vendored
Normal file
|
@ -0,0 +1,215 @@
|
|||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
*.pubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
#############
|
||||
## Windows detritus
|
||||
#############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist/
|
||||
build/
|
||||
eggs/
|
||||
parts/
|
||||
var/
|
||||
sdist/
|
||||
develop-eggs/
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
42
ort_erstellen.php
Normal file
42
ort_erstellen.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Ort hinzufügen</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Ort hinzufügen</h1>
|
||||
<form action="ort_erstellen.php" method="POST">
|
||||
<p>Name: <input type="text" name="name" maxlength="50"/></p>
|
||||
<p>PLZ: <input type="text" name="plz" maxlength="5" size="5" /> Stadt: <input type="text" name="stadt" maxlength="50"/></p>
|
||||
<p>Straße: <input type="text" name="strasse" maxlength="50" size="5" /> Hausnummer: <input type="text" name="hausnummer" maxlength="5" size="3"/></p>
|
||||
<p><input type="submit" value="Ort hinzufügen"></p>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
require_once "verbindungsaufbau.php"; //mit Server verbinden
|
||||
|
||||
if (isset($_POST["name"])) { //Wenn das Formular ausgefüllt wurde ...
|
||||
$name = $_POST["name"];
|
||||
$plz = $_POST["plz"];
|
||||
$stadt = $_POST["stadt"];
|
||||
$strasse = $_POST["strasse"];
|
||||
$hausnummer = $_POST["hausnummer"];
|
||||
if ($stmt = $mysqli->prepare("INSERT INTO orte (ort_name, stadt, plz, strasse, hausnummer) VALUES (?, ?, ?, ?, ?)")) { // Der SQL-Befehl wirdvorbereitet ...
|
||||
$stmt->bind_param("sssss", $name, $stadt, $plz, $strasse, $hausnummer); // ... eingesetzt ...
|
||||
$stmt->execute(); // ... und ausgeführt
|
||||
$stmt->close();
|
||||
$mysqli->close();
|
||||
header("Location: http://localhost/mysql/veranstaltung/orte.php"); // Auf die Hauptseite weiterleiten
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
19
ort_loeschen.php
Normal file
19
ort_loeschen.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
require_once "verbindungsaufbau.php";
|
||||
|
||||
|
||||
if (isset($_GET["id"]) && is_numeric($_GET["id"])) {
|
||||
$id = $_GET["id"];
|
||||
if ($stmt = $mysqli->prepare("DELETE FROM veranstaltungen WHERE veranstaltungs_id=?")) {
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
$mysqli->close();
|
||||
header("Location: http://localhost/mysql/veranstaltung/veranstaltungen.php");
|
||||
} else {
|
||||
echo "Fehler";
|
||||
}
|
||||
} else {
|
||||
echo "unerlaubter Parameter";
|
||||
}
|
||||
?>
|
41
orte.php
Normal file
41
orte.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Meine Website</title>
|
||||
<meta name="author" content="Lukas" >
|
||||
<style>
|
||||
tr:nth-child(2n) td {
|
||||
background: #EEE8AA;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
require_once "verbindungsaufbau.php"; //mit Server verbinden
|
||||
|
||||
$ergebnis = $mysqli->query("SELECT * FROM orte"); //SQL Befehl ausführen
|
||||
echo "<table border='1'>\n";
|
||||
echo "<tr><th>Name</th><th>Stadt</th><th>Straße</th><th>Ändern</th><th>Löschen</th>"; //Zeile mit Überschriften
|
||||
while ($zeile = $ergebnis->fetch_array()) {
|
||||
echo "<tr><td>" . htmlspecialchars($zeile["ort_name"]) . "</td>"
|
||||
. "<td>" . htmlspecialchars($zeile['plz']) . " " . htmlspecialchars($zeile['stadt']) . "</td> "
|
||||
. "<td> " . htmlspecialchars($zeile['strasse']) . " " . htmlspecialchars($zeile['hausnummer']) . "</td>"
|
||||
. "<td><a href='./ort_aendern.php?id=" . htmlspecialchars($zeile['ort_id']) . "'>ändern</a></td>"
|
||||
. "<td><a href='./ort_loeschen.php?id=" . htmlspecialchars($zeile['ort_id']) . "'>löschen</a></td>"
|
||||
."</td></tr>\n" ;
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$ergebnis->close();
|
||||
$mysqli->close();
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<a href="ort_erstellen.php">neuen Ort hinzufügen</a>
|
||||
</body>
|
||||
</html>
|
80
veranstaltung_aendern.php
Normal file
80
veranstaltung_aendern.php
Normal file
|
@ -0,0 +1,80 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Veranstaltung ändern</title>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
require_once "verbindungsaufbau.php";
|
||||
if (empty($_POST["name"])) {
|
||||
if (!isset($_GET["id"]) || !is_numeric($_GET["id"])) { // wenn die id-manipuliert wurde abbrechen
|
||||
header("Location: http://localhost/mysql/veranstaltung/veranstaltungen.php");
|
||||
|
||||
}
|
||||
$id = $_GET["id"];
|
||||
if ($stmt = $mysqli->prepare("SELECT name, beschreibung, zeit, ort_id FROM veranstaltungen WHERE veranstaltungs_id=?")) {
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($name, $beschreibung, $datetime, $ort); //Daten auslesen und in Variablen speichern
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
$zeit = explode(" ", $datetime); // Zeit wieder in Datum und Uhrzeit aufteilen
|
||||
}
|
||||
?>
|
||||
<h1>Veranstaltung ändern</h1>
|
||||
<form action="veranstaltung_aendern.php" method="POST">
|
||||
<p>Name: <input type="text" name="name" maxlength="50" value="<?php echo htmlspecialchars($name) ?>"/></p>
|
||||
<p>Beschreibung: <textarea name="beschreibung" cols="30" rows="3"><?php echo htmlspecialchars($beschreibung) ?></textarea> </p>
|
||||
<p>Tag (dd.mm.yyyy): <input type="date" name="tag" value="<?php echo htmlspecialchars($zeit[0]) ?>" />Uhrzeit (HH:MM): <input type="time" name="zeit" value="<?php echo htmlspecialchars($zeit[1]) ?>" /></p>
|
||||
Veranstaltungsort:<select name="ort" size="1">
|
||||
<?php
|
||||
$ergebnis = $mysqli->query("SELECT * FROM orte");
|
||||
while ($zeile = $ergebnis->fetch_array()) {
|
||||
if ($zeile['ort_id'] == $ort) {
|
||||
echo "<option selected value='" . htmlspecialchars($zeile['ort_id']) . "'>" . htmlspecialchars($zeile['ort_name']) . "</option>\n";
|
||||
} else {
|
||||
echo "<option value='" . htmlspecialchars($zeile['ort_id']) . "'>" . htmlspecialchars($zeile['ort_name']) . "</option>\n";
|
||||
}
|
||||
}
|
||||
$mysqli->close();
|
||||
?>
|
||||
</select> <a href="./orte_bearbeiten.php" target="Orte" >Orte bearbeiten</a>
|
||||
<input type="hidden" name="id" value="<?php echo $id ?>" />
|
||||
<p><input type="submit" value="Veranstaltung ändern"></p>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
|
||||
} else {
|
||||
$name = $_POST["name"];
|
||||
$beschreibung = $_POST["beschreibung"];
|
||||
$tag = $_POST["tag"];
|
||||
$zeit = $_POST["zeit"];
|
||||
$ort = $_POST["ort"];
|
||||
$id = $_POST["id"];
|
||||
echo $id;
|
||||
$datetime = $tag . " " . $zeit . ":00";
|
||||
if ($stmt = $mysqli->prepare("UPDATE veranstaltungen set name=?, beschreibung=?, zeit=?, ort_id=? WHERE veranstaltungs_id=?")) {
|
||||
$stmt->bind_param("sssii", $name, $beschreibung, $datetime, $ort, $id);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
$mysqli->close();
|
||||
header("Location: http://localhost/mysql/veranstaltung/veranstaltungen.php");
|
||||
|
||||
} else {
|
||||
echo "Wir haben ein Problem: " . $mysqli->error;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
53
veranstaltung_erstellen.php
Normal file
53
veranstaltung_erstellen.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Veranstaltung erstellen</title>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Veranstaltung erstellen</h1>
|
||||
<form action="veranstaltung_erstellen.php" method="POST">
|
||||
<p>Name: <input type="text" name="name" maxlength="50"/></p>
|
||||
<p>Beschreibung: <textarea name="beschreibung" cols="30" rows="3" ></textarea> </p>
|
||||
<p>Tag (dd.mm.yyyy): <input type="date" name="tag" />Uhrzeit (HH:MM): <input type="time" name="zeit" /></p>
|
||||
Veranstaltungsort:<select name="ort" size="1">
|
||||
<?php
|
||||
require_once "verbindungsaufbau.php";
|
||||
|
||||
|
||||
$ergebnis = $mysqli->query("SELECT * FROM orte"); //Ort-Tabelle auslesen
|
||||
while ($zeile = $ergebnis->fetch_array()) {
|
||||
echo "<option value='" . htmlspecialchars($zeile['ort_id']) . "'>" . htmlspecialchars($zeile['ort_name']) . "</option>\n"; //Optionen in Dropdown-Liste eingeben
|
||||
}
|
||||
?>
|
||||
</select> <a href="./orte_bearbeiten.php" target="Orte" >Orte bearbeiten</a>
|
||||
<p><input type="submit" value="Veranstaltung hinzufügen"></p>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
if (isset($_POST["name"]) && isset($_POST["beschreibung"]) && isset($_POST["tag"]) && isset($_POST["zeit"]) && isset($_POST["ort"])) { //Wenn das Formular ausgefüllt wurde ...
|
||||
$name = $_POST["name"];
|
||||
$beschreibung = $_POST["beschreibung"];
|
||||
$tag = $_POST["tag"];
|
||||
$zeit = $_POST["zeit"];
|
||||
$ort = $_POST["ort"];
|
||||
$datetime = $tag . " " . $zeit . ":00"; // ... werden Tag und Uhrzeit zusammengefügt
|
||||
if ($stmt = $mysqli->prepare("INSERT INTO veranstaltungen (name, beschreibung, zeit, ort_id) VALUES (?, ?, ?, ?)")) { // Der SQL-Befehl wirdvorbereitet ...
|
||||
$stmt->bind_param("sssi", $name, $beschreibung, $datetime, $ort); // ... eingesetzt ...
|
||||
$stmt->execute(); // ... und ausgeführt
|
||||
$stmt->close();
|
||||
$mysqli->close();
|
||||
header("Location: http://localhost/mysql/veranstaltung/veranstaltungen.php"); // Auf die Hauptseite weiterleiten
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
19
veranstaltung_loeschen.php
Normal file
19
veranstaltung_loeschen.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
require_once "verbindungsaufbau.php";
|
||||
|
||||
|
||||
if (isset($_GET["id"]) && is_numeric($_GET["id"])) {
|
||||
$id = $_GET["id"];
|
||||
if ($stmt = $mysqli->prepare("DELETE FROM veranstaltungen WHERE veranstaltungs_id=?")) {
|
||||
$stmt->bind_param("i", $id);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
$mysqli->close();
|
||||
header("Location: http://localhost/mysql/veranstaltung/veranstaltungen.php");
|
||||
} else {
|
||||
echo "Fehler";
|
||||
}
|
||||
} else {
|
||||
echo "unerlaubter Parameter";
|
||||
}
|
||||
?>
|
43
veranstaltungen.php
Normal file
43
veranstaltungen.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Meine Website</title>
|
||||
<meta name="author" content="Lukas" >
|
||||
<style>
|
||||
tr:nth-child(2n) td {
|
||||
background: #EEE8AA;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
require_once "verbindungsaufbau.php"; //mit Server verbinden
|
||||
|
||||
$ergebnis = $mysqli->query("SELECT * FROM orte, veranstaltungen WHERE orte.ort_id = veranstaltungen.ort_id"); //SQL Befehl ausführen
|
||||
echo "<table border='1'>\n";
|
||||
echo "<tr><th>Veranstaltungsname</th><th>Beschreibung</th><th>Zeit</th><th>Ort</th><th>Adresse</th><th>Ändern</th><th>Löschen</th>"; //Zeile mit Überschriften
|
||||
while ($zeile = $ergebnis->fetch_array()) {
|
||||
echo "<tr><td>" . htmlspecialchars($zeile["name"]) . "</td>"
|
||||
. "<td>" . htmlspecialchars($zeile['beschreibung']) . "</td>"
|
||||
. "<td>" . date( 'd.m.Y H:i', strtotime(htmlspecialchars($zeile['zeit'])))
|
||||
. "<td>" . htmlspecialchars($zeile['ort_name']) . "</td>"
|
||||
. "<td>" . htmlspecialchars($zeile['plz']) . " " . htmlspecialchars($zeile['stadt']) . "<br /> " . htmlspecialchars($zeile['strasse']) . " " . htmlspecialchars($zeile['hausnummer']) . "</td>"
|
||||
. "<td><a href='./veranstaltung_aendern.php?id=" . htmlspecialchars($zeile['veranstaltungs_id']) . "'>ändern</a></td>"
|
||||
. "<td><a href='./veranstaltung_loeschen.php?id=" . htmlspecialchars($zeile['veranstaltungs_id']) . "'>löschen</a></td>"
|
||||
."</td></tr>\n" ;
|
||||
}
|
||||
echo "</table>";
|
||||
|
||||
$ergebnis->close();
|
||||
$mysqli->close();
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<a href="veranstaltung_erstellen.php">Veranstaltung erstellen</a>
|
||||
</body>
|
||||
</html>
|
10
verbindungsaufbau.php
Normal file
10
verbindungsaufbau.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
$mysqli = new mysqli("localhost", "root", "", "veranstaltung"); //Mit MySQL verbinden
|
||||
if ($mysqli->connect_error) {
|
||||
echo "Verbindungsfehler: ". mysql_connect_error();
|
||||
exit;
|
||||
}
|
||||
if (!$mysqli->set_charset("utf8")) { //Zeichensatz auf UTF-8 setzen (Umlaute!)
|
||||
echo "Fehler beim Laden von UTF-8";
|
||||
}
|
||||
?>
|
Reference in a new issue