From 764dc56beb5f0a85f662bf95ac8708117032f5b9 Mon Sep 17 00:00:00 2001 From: Findus23 Date: Fri, 27 Dec 2013 10:20:00 +0100 Subject: [PATCH] erstmaliges Hochladen --- .gitattributes | 22 ++++ .gitignore | 215 ++++++++++++++++++++++++++++++++++++ ort_erstellen.php | 42 +++++++ ort_loeschen.php | 19 ++++ orte.php | 41 +++++++ veranstaltung_aendern.php | 80 ++++++++++++++ veranstaltung_erstellen.php | 53 +++++++++ veranstaltung_loeschen.php | 19 ++++ veranstaltungen.php | 43 ++++++++ verbindungsaufbau.php | 10 ++ 10 files changed, 544 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 ort_erstellen.php create mode 100644 ort_loeschen.php create mode 100644 orte.php create mode 100644 veranstaltung_aendern.php create mode 100644 veranstaltung_erstellen.php create mode 100644 veranstaltung_loeschen.php create mode 100644 veranstaltungen.php create mode 100644 verbindungsaufbau.php diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..412eeda --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9d6bd9 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/ort_erstellen.php b/ort_erstellen.php new file mode 100644 index 0000000..1df08c1 --- /dev/null +++ b/ort_erstellen.php @@ -0,0 +1,42 @@ + + + + + + + Ort hinzufügen + + + + +

Ort hinzufügen

+
+

Name:

+

PLZ: Stadt:

+

Straße: Hausnummer:

+

+ + +
+ +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 + } +} +?> + + + \ No newline at end of file diff --git a/ort_loeschen.php b/ort_loeschen.php new file mode 100644 index 0000000..0deef00 --- /dev/null +++ b/ort_loeschen.php @@ -0,0 +1,19 @@ +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"; +} +?> \ No newline at end of file diff --git a/orte.php b/orte.php new file mode 100644 index 0000000..a5f426c --- /dev/null +++ b/orte.php @@ -0,0 +1,41 @@ + + + + + + Meine Website + + + + + +query("SELECT * FROM orte"); //SQL Befehl ausführen +echo "\n"; +echo ""; //Zeile mit Überschriften +while ($zeile = $ergebnis->fetch_array()) { + echo "" + . " " + . "" + . "" + . "" + ."\n" ; +} +echo "
NameStadtStraßeÄndernLöschen
" . htmlspecialchars($zeile["ort_name"]) . "" . htmlspecialchars($zeile['plz']) . " " . htmlspecialchars($zeile['stadt']) . " " . htmlspecialchars($zeile['strasse']) . " " . htmlspecialchars($zeile['hausnummer']) . "ändernlöschen
"; + +$ergebnis->close(); +$mysqli->close(); + + +?> + +neuen Ort hinzufügen + + \ No newline at end of file diff --git a/veranstaltung_aendern.php b/veranstaltung_aendern.php new file mode 100644 index 0000000..b40531b --- /dev/null +++ b/veranstaltung_aendern.php @@ -0,0 +1,80 @@ + + + + + + Veranstaltung ändern + + + + + +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 + } +?> +

Veranstaltung ändern

+
+

Name:

+

Beschreibung:

+

Tag (dd.mm.yyyy): Uhrzeit (HH:MM):

+Veranstaltungsort: Orte bearbeiten + +

+ + +
+ +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; + } + +} + +?> + + + \ No newline at end of file diff --git a/veranstaltung_erstellen.php b/veranstaltung_erstellen.php new file mode 100644 index 0000000..4c5a80a --- /dev/null +++ b/veranstaltung_erstellen.php @@ -0,0 +1,53 @@ + + + + + + Veranstaltung erstellen + + + + + + +

Veranstaltung erstellen

+
+

Name:

+

Beschreibung:

+

Tag (dd.mm.yyyy): Uhrzeit (HH:MM):

+Veranstaltungsort: Orte bearbeiten +

+ + +
+ +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 + } +} +?> + + + \ No newline at end of file diff --git a/veranstaltung_loeschen.php b/veranstaltung_loeschen.php new file mode 100644 index 0000000..0deef00 --- /dev/null +++ b/veranstaltung_loeschen.php @@ -0,0 +1,19 @@ +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"; +} +?> \ No newline at end of file diff --git a/veranstaltungen.php b/veranstaltungen.php new file mode 100644 index 0000000..5516de9 --- /dev/null +++ b/veranstaltungen.php @@ -0,0 +1,43 @@ + + + + + + Meine Website + + + + + +query("SELECT * FROM orte, veranstaltungen WHERE orte.ort_id = veranstaltungen.ort_id"); //SQL Befehl ausführen +echo "\n"; +echo ""; //Zeile mit Überschriften +while ($zeile = $ergebnis->fetch_array()) { + echo "" + . "" + . "" + . "" + . "" + . "" + ."\n" ; +} +echo "
VeranstaltungsnameBeschreibungZeitOrtAdresseÄndernLöschen
" . htmlspecialchars($zeile["name"]) . "" . htmlspecialchars($zeile['beschreibung']) . "" . date( 'd.m.Y H:i', strtotime(htmlspecialchars($zeile['zeit']))) + . "" . htmlspecialchars($zeile['ort_name']) . "" . htmlspecialchars($zeile['plz']) . " " . htmlspecialchars($zeile['stadt']) . "
" . htmlspecialchars($zeile['strasse']) . " " . htmlspecialchars($zeile['hausnummer']) . "
ändernlöschen
"; + +$ergebnis->close(); +$mysqli->close(); + + +?> + +Veranstaltung erstellen + + \ No newline at end of file diff --git a/verbindungsaufbau.php b/verbindungsaufbau.php new file mode 100644 index 0000000..11e8b09 --- /dev/null +++ b/verbindungsaufbau.php @@ -0,0 +1,10 @@ +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"; +} +?> \ No newline at end of file