This repository has been archived by the owner on May 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
salva.php
68 lines (53 loc) · 1.51 KB
/
salva.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
require_once('commons.php');
doHeader();
$valid = true;
$mandatory = ['email', 'lat', 'lng'];
foreach($mandatory as $m) {
if (!isset($_POST[$m]) || empty($_POST[$m]))
$valid = false;
}
if ($valid == false): ?>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger">
<p>Attenzione! Mancano dei campi obbligatori!</p>
<p>Sicuro di aver compilato tutto il form?</p>
</div>
</div>
</div>
</div>
</div>
<?php else: ?>
<?php
if (isset($_POST['wannabe']))
$wannabe = 'true';
else
$wannabe = 'false';
if (isset($_POST['notes']) && !empty($_POST['notes'])) {
$notes = $_POST['notes'];
$notes = str_replace("\n", ' ', $notes);
$notes = str_replace("\r", '', $notes);
}
else {
$notes = '';
}
$registration = sprintf("%s|%s|%s|%s|%s\n", $_POST['email'], $_POST['lat'], $_POST['lng'], $wannabe, $notes);
file_put_contents('data/registrations.csv', $registration, FILE_APPEND);
?>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="row">
<div class="col-md-12">
<div class="alert alert-success">
<p>Grazie per la tua registrazione!</p>
<p>Torna a consultare questo sito per ulteriori dettagli sul coordinamento dell'evento, oppure iscriviti alla mailing list <a href="http://lists.linux.it/listinfo/linuxday-idee" class="alert-link">LinuxDay-Idee</a> per partecipare direttamente alla discussione.</p>
</div>
</div>
</div>
</div>
</div>
<?php endif ?>
<?php doFooter() ?>