-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.php
161 lines (124 loc) · 4.94 KB
/
index.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
/*Codice della mappa dei LUG italiani
Copyright (C) 2013-2014 Italian Linux Society - http://www.linux.it
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.*/
?>
<?php
function gen_uuid () {
return sprintf ('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand (0, 0xffff), mt_rand (0, 0xffff),
mt_rand (0, 0xffff),
mt_rand (0, 0x0fff) | 0x4000,
mt_rand (0, 0x3fff) | 0x8000,
mt_rand (0, 0xffff), mt_rand (0, 0xffff), mt_rand (0, 0xffff)
);
}
$msg = '';
if (array_key_exists ('subscribe', $_GET)) {
if (array_key_exists ('name', $_POST) == true && $_POST ['name'] != '') {
header ('Location: http://lugmap.linux.it/');
exit ();
}
if (array_key_exists ('mail', $_POST) == false ||
$_POST ['mail'] == '' ||
array_key_exists ('prov', $_POST) == false ||
array_key_exists ('university', $_POST) == false ||
($_POST ['prov'] == '-1' && $_POST ['university'] == '-1') ||
filter_var ($_POST ['mail'], FILTER_VALIDATE_EMAIL) == false) {
$msg = "Dati non validi! Riscrivi il tuo indirizzo mail e seleziona una provincia o una università!";
}
else {
$mail = $_POST ['mail'];
if ($_POST ['prov'] != '-1')
$prov = $_POST ['prov'];
else
$prov = $_POST ['university'];
$date = date ('d-m-Y');
$uuid = gen_uuid ();
$data = file ('../data/radar.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$counter = 0;
foreach ($data as $d) {
list ($m, $p, $u) = explode ('|', $d);
if ($m == $mail)
$counter++;
unset ($m);
unset ($p);
unset ($u);
}
unset ($data);
/*
Controllo per evitare che qualcuno abusi del
servizio: ci si puo' registrare al massimo tre
volte con lo stesso indirizzo
*/
if ($counter < 3) {
$f = fopen ('../data/radar_pending.txt', 'a');
fwrite ($f, "$mail|$prov|$uuid|$date\n");
fclose ($f);
$headers = "From: webmaster@linux.it\r\n";
$message =<<<TEXT
Grazie per esserti registrato sul LugRadar!
Questa e' una mail di verifica, per testare la validita' del tuo
indirizzo mail: per cortesia clicca il link seguente per completare la
procedura:
http://lugmap.linux.it/radar/confirm.php?id=$uuid
Per qualsiasi dubbio o domanda, contatta l'indirizzo webmaster@linux.it
TEXT;
mail ($mail, 'Conferma iscrizione LugRadar', $message, $headers);
}
header ('Location: http://lugmap.linux.it/radar/confirm.php');
exit ();
}
}
require_once ('../funzioni.php');
lugheader ('Radar', array ('http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css'), array ('http://code.jquery.com/ui/1.10.3/jquery-ui.js', 'radar.js'));
if ($msg != '') {
?>
<p style="text-align: center; border: 2px solid #FF0000"><?php echo $msg ?></p>
<?php
}
?>
<table width="70%" align="center">
<tr>
<td>
<img src="/immagini/radar.png" style="float: right" class="radar" />
<p>I Linux Users Groups sono tantissimi, ma mai abbastanza!</p>
<br />
<p>Nella tua zona non c'è un LUG? O è troppo distante? Ci sono altri appassionati di software libero e tecnologia nella tua università, nella tua azienda, nel tuo quartiere, ma non sai come identificarli e coinvolgerli?</p>
<p>Costruire un LUG non è complicato, e da oggi lo è ancora meno!</p>
<p>Indica qui di seguito il tuo indirizzo mail e la tua provincia, quando qualcun'altro nella stessa area farà altrettanto riceverete entrambi un messaggio per mettervi reciprocamente in contatto, conoscervi, eventualmente incontrarvi, e magari presto fondare un nuovo Users Group insieme!</p>
<br />
<form action="?subscribe=1" method="POST">
<p>
<input type="text" name="mail" placeholder="Indirizzo Mail" />
</p>
<p>
<?php prov_select ('') ?> o, se sei studente universitario,<br />
<input type="text" name="universitytext" id="universitytext" size="50" placeholder="Scrivi e seleziona qui il nome della tua università" />
<input type="hidden" name="university" id="university" value="-1" />
</p>
<p>
<input type="submit" value="Invia" />
</p>
<p style="display: none">
<input type="text" name="name" />
</p>
</form>
<br />
<p>Leggi il <a href="http://www.ils.org/progetti#servizi">Manuale Operativo per la Community</a> o <a href="http://www.ils.org/contatti">chiedi consulto a ILS</a> per maggiori informazioni sulla creazione di un LUG.</p>
<p> </p>
</td>
</tr>
</table>
<?php
lugfooter ();
?>