From 1112cae21f7e16705e4ad1764734629100ca1371 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Wed, 5 May 2021 12:40:57 +0200 Subject: [PATCH] Anpassungen --- create.sql | 3 ++- index.php | 20 +++++++++++++++----- overview.php | 10 ++++++---- submit.php | 4 +++- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/create.sql b/create.sql index 3bbeb7c..899a444 100644 --- a/create.sql +++ b/create.sql @@ -1,5 +1,6 @@ create table entries(id bigint auto_increment primary key, name varchar(255), mail varchar(255), - year int(4), birthday date, verify bool, vocation varchar(255), creation DATE + year int(4), birthday date, verify bool, vocation varchar(255), creation DATE, + location varchar(100), phone varchar(50) ); create table verify(id bigint primary key, uuid VARCHAR(36),foreign key verify(id) REFERENCES entries(id)); diff --git a/index.php b/index.php index 178b4c5..281fa31 100644 --- a/index.php +++ b/index.php @@ -28,12 +28,22 @@ $maxDate = date("m-d-Y", strtotime("-10 years"));
- +
- + +
+ +
+ + +
+ +
+ +
@@ -41,7 +51,7 @@ $maxDate = date("m-d-Y", strtotime("-10 years")); " max="" class="form-input"> +
- +
diff --git a/overview.php b/overview.php index d70e74c..b0f3750 100644 --- a/overview.php +++ b/overview.php @@ -28,12 +28,12 @@ if($_GET['export'] != null) { $f = fopen('php://memory', 'w'); //set column headers - $fields = array("ID", "Name", "E-Mail", "Abschlussjahrgang", "Geburtstag", "Email validiert", "Tätigkeit", "Eintragungsdatum"); + $fields = array("ID", "Name", "E-Mail", "Telefon", "Wohnort", "Abschlussjahrgang", "Geburtstag", "Email validiert", "Tätigkeit", "Eintragungsdatum"); fputcsv($f, $fields, $delimiter); //output each row of the data, format line as csv and write to file pointer foreach ($entries as $entry) { - $lineData = array($entry['id'], $entry['name'], $entry['mail'], $entry['year'], $entry['birthday'], $entry['verify'], $entry['vocation'], $entry['creation']); + $lineData = array($entry['id'], $entry['name'], $entry['mail'], $entry['phone'], $entry['location'], $entry['year'], $entry['birthday'], $entry['verify'], $entry['vocation'], $entry['creation']); fputcsv($f, $lineData, $delimiter); } @@ -69,7 +69,8 @@ returnHeader(); Name Tätigkeit - E-Mail Adresse + E-Mail Adresse & Telefon + Wohnort Jahrgang Alter Eintragung @@ -87,7 +88,8 @@ returnHeader(); - + + diff --git a/submit.php b/submit.php index 7c52d35..9c67039 100644 --- a/submit.php +++ b/submit.php @@ -15,6 +15,8 @@ $validator = new Validator; $validation = $validator->make($_POST,[ 'name' => 'required', 'email' => 'required|email', + 'phone' => 'nullable|numeric', + 'location' => 'nullable|alpha', 'year' => 'required|numeric', 'birthday' => 'required|date', 'vocation' => 'required', @@ -47,7 +49,7 @@ $validData['verify'] = 0; unset($validData['privacy']); $db = getDatabase(); -$statement = $db->prepare("INSERT INTO entries(name, mail, year, birthday, verify, vocation, creation) VALUES (:name, :email, :year, :birthday, :verify, :vocation, CURDATE())"); +$statement = $db->prepare("INSERT INTO entries(name, mail, phone, location, year, birthday, verify, vocation, creation) VALUES (:name, :email, :phone, :location, :year, :birthday, :verify, :vocation, CURDATE())"); if(!$statement->execute($validData)) { echo "Datenbank Fehler";