Anpassungen

This commit is contained in:
Johannes Theiner 2021-05-05 12:40:57 +02:00
parent 9dfe5d8a5e
commit 1112cae21f
4 changed files with 26 additions and 11 deletions

View File

@ -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));

View File

@ -28,12 +28,22 @@ $maxDate = date("m-d-Y", strtotime("-10 years"));
<div class="form-group">
<label class="form-label" for="name">Name</label>
<input type="text" name="name" id="name" required="required" class="form-input">
<input type="text" name="name" id="name" required="required" class="form-input" placeholder="Erforderlich">
</div>
<div class="form-group">
<label class="form-label" for="email">E-Mail Adresse</label>
<input type="email" name="email" id="email" required="required" class="form-input">
<input type="email" name="email" id="email" required="required" class="form-input" placeholder="Erforderlich">
</div>
<div class="form-group">
<label class="form-label" for="phone">Telefonnummer</label>
<input type="tel" name="phone" id="phone" class="form-input" placeholder="Optional">
</div>
<div class="form-group">
<label class="form-label" for="location">Wohnort</label>
<input type="text" name="location" id="location" class="form-input" placeholder="Optional">
</div>
<div class="form-group">
@ -41,7 +51,7 @@ $maxDate = date("m-d-Y", strtotime("-10 years"));
<select name="year" id="year" required="required" class="form-select">
<option disabled="disabled" selected="selected" hidden="hidden">---</option>
<?php
for ($i = 1970; $i < date("Y"); $i++) {
for ($i = date("Y") - 80; $i < date("Y"); $i++) {
?>
<option><?php echo $i ?></option>
<?php
@ -51,12 +61,12 @@ $maxDate = date("m-d-Y", strtotime("-10 years"));
</div>
<div class="form-group">
<label class="form-label" for="birthday">Geburtstag</label>
<input type="date" name="birthday" id="birthday" required="required" pattern="\d{2}-\d{2}-\d{4} min="<?php echo $minDate ?>" max="<?php echo $maxDate ?>" class="form-input">
<input type="date" name="birthday" id="birthday" required="required" pattern="\d{2}-\d{2}-\d{4}" min="<?php echo $minDate ?>" max="<?php echo $maxDate ?>" class="form-input">
</div>
<div class="form-group">
<label class="form-label" for="vocation">Tätigkeit</label>
<textarea name="vocation" id="vocation" required="required" class="form-input"></textarea>
<textarea name="vocation" id="vocation" required="required" class="form-input" placeholder="Erforderlich"></textarea>
</div>
<div class="form-group">

View File

@ -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();
<tr>
<th>Name</th>
<th>Tätigkeit</th>
<th>E-Mail Adresse</th>
<th>E-Mail Adresse & Telefon</th>
<th>Wohnort</th>
<th>Jahrgang</th>
<th>Alter</th>
<th>Eintragung</th>
@ -87,7 +88,8 @@ returnHeader();
<tr>
<td><?php echo $entry["name"] ?></td>
<td><?php echo $entry["vocation"] ?></td>
<td><?php echo $entry["mail"] ?></td>
<td><?php echo $entry["mail"] . " "; echo (isset($entry['phone'])) ? $entry['phone'] : "" ?></td>
<td><?php echo (isset($entry['location'])) ? $entry['location'] : "" ?></td>
<td><?php echo $entry["year"] ?></td>
<td><?php echo $age ?></td>
<td><?php echo date_format($creationDate, "d.m.Y") ?></td>

View File

@ -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";