Anpassungen
This commit is contained in:
parent
9dfe5d8a5e
commit
1112cae21f
|
@ -1,5 +1,6 @@
|
||||||
create table entries(id bigint auto_increment primary key, name varchar(255), mail varchar(255),
|
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));
|
create table verify(id bigint primary key, uuid VARCHAR(36),foreign key verify(id) REFERENCES entries(id));
|
||||||
|
|
20
index.php
20
index.php
|
@ -28,12 +28,22 @@ $maxDate = date("m-d-Y", strtotime("-10 years"));
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="name">Name</label>
|
<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>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="email">E-Mail Adresse</label>
|
<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>
|
||||||
|
|
||||||
<div class="form-group">
|
<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">
|
<select name="year" id="year" required="required" class="form-select">
|
||||||
<option disabled="disabled" selected="selected" hidden="hidden">---</option>
|
<option disabled="disabled" selected="selected" hidden="hidden">---</option>
|
||||||
<?php
|
<?php
|
||||||
for ($i = 1970; $i < date("Y"); $i++) {
|
for ($i = date("Y") - 80; $i < date("Y"); $i++) {
|
||||||
?>
|
?>
|
||||||
<option><?php echo $i ?></option>
|
<option><?php echo $i ?></option>
|
||||||
<?php
|
<?php
|
||||||
|
@ -51,12 +61,12 @@ $maxDate = date("m-d-Y", strtotime("-10 years"));
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="birthday">Geburtstag</label>
|
<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>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="vocation">Tätigkeit</label>
|
<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>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
10
overview.php
10
overview.php
|
@ -28,12 +28,12 @@ if($_GET['export'] != null) {
|
||||||
$f = fopen('php://memory', 'w');
|
$f = fopen('php://memory', 'w');
|
||||||
|
|
||||||
//set column headers
|
//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);
|
fputcsv($f, $fields, $delimiter);
|
||||||
|
|
||||||
//output each row of the data, format line as csv and write to file pointer
|
//output each row of the data, format line as csv and write to file pointer
|
||||||
foreach ($entries as $entry) {
|
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);
|
fputcsv($f, $lineData, $delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,8 @@ returnHeader();
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Tätigkeit</th>
|
<th>Tätigkeit</th>
|
||||||
<th>E-Mail Adresse</th>
|
<th>E-Mail Adresse & Telefon</th>
|
||||||
|
<th>Wohnort</th>
|
||||||
<th>Jahrgang</th>
|
<th>Jahrgang</th>
|
||||||
<th>Alter</th>
|
<th>Alter</th>
|
||||||
<th>Eintragung</th>
|
<th>Eintragung</th>
|
||||||
|
@ -87,7 +88,8 @@ returnHeader();
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $entry["name"] ?></td>
|
<td><?php echo $entry["name"] ?></td>
|
||||||
<td><?php echo $entry["vocation"] ?></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 $entry["year"] ?></td>
|
||||||
<td><?php echo $age ?></td>
|
<td><?php echo $age ?></td>
|
||||||
<td><?php echo date_format($creationDate, "d.m.Y") ?></td>
|
<td><?php echo date_format($creationDate, "d.m.Y") ?></td>
|
||||||
|
|
|
@ -15,6 +15,8 @@ $validator = new Validator;
|
||||||
$validation = $validator->make($_POST,[
|
$validation = $validator->make($_POST,[
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'email' => 'required|email',
|
'email' => 'required|email',
|
||||||
|
'phone' => 'nullable|numeric',
|
||||||
|
'location' => 'nullable|alpha',
|
||||||
'year' => 'required|numeric',
|
'year' => 'required|numeric',
|
||||||
'birthday' => 'required|date',
|
'birthday' => 'required|date',
|
||||||
'vocation' => 'required',
|
'vocation' => 'required',
|
||||||
|
@ -47,7 +49,7 @@ $validData['verify'] = 0;
|
||||||
unset($validData['privacy']);
|
unset($validData['privacy']);
|
||||||
|
|
||||||
$db = getDatabase();
|
$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)) {
|
if(!$statement->execute($validData)) {
|
||||||
echo "Datenbank Fehler";
|
echo "Datenbank Fehler";
|
||||||
|
|
Loading…
Reference in New Issue