5 * Copyright (C) 2014 Matteo Nastasi
6 * mailto: nastasi@alternativeoutput.it
7 * matteo.nastasi@milug.org
8 * web: http://www.alternativeoutput.it
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details. You should have received a
19 * copy of the GNU General Public License along with this program; if
20 * not, write to the Free Software Foundation, Inc, 59 Temple Place -
21 * Suite 330, Boston, MA 02111-1307, USA.
25 foreach (array("HTTP_HOST", "DOCUMENT_ROOT") as $i) {
26 if (isset($_SERVER[$i])) {
31 foreach (array("f_act", "f_code", "f_hash") as $i) {
32 if (isset($_GET[$i])) {
40 ini_set("max_execution_time", "240");
42 require_once($G_base."Obj/brisk.phh");
43 require_once($G_base."Obj/user.phh");
44 require_once($G_base."Obj/auth.phh");
45 require_once($G_base."Obj/dbase_${G_dbasetype}.phh");
46 require_once($G_base."Obj/singlemsg.phh");
48 require_once($G_base."spush/brisk-spush.phh");
50 define('MAILMGR_CHECKMAIL', 1);
53 // GLOBAL $G_dbpfx, $G_alarm_passwd, $f_mailusers, $sess, $_POST, $_SERVER;
54 GLOBAL $G_dbpfx, $f_act, $f_code, $f_hash;
56 /* echo "act: $f_act<br>";
57 echo "code: $f_code<br>";
58 echo "hash: $f_hash<br>"; */
60 if ($f_act == "checkmail") {
63 if (($bdb = BriskDB::create()) == FALSE) {
64 log_crit("stat-day: database connection failed");
68 $bdb->transaction('BEGIN');
70 if (($mai = $bdb->mail_check($f_code, MAILMGR_CHECKMAIL, $f_hash)) == FALSE) {
75 if (($bdb->user_update_flag_ty($mai->ucode, USER_FLAG_TY_DISABLE,
76 TRUE, USER_DIS_REA_NU_MAILED,
77 TRUE, USER_DIS_REA_NU_TOBECHK)) == FALSE) {
82 if (($mai = $bdb->mail_delete($f_code)) == FALSE) {
86 $bdb->transaction('COMMIT');
88 singlemsg("Verifica della e-mail andata a buon fine.", "Verifica della e-mail andata a buon fine.<br>Riceverai a breve una email con la tua nuova password.<br>Benvenuto!");
92 if ($errcode == 10002) {
93 singlemsg("L'email è già stata verificata con successo.",
94 "L'email è già stata verificata con successo, ora attenda che le venga recapitata la password.");
97 singlemsg("E' occorso un errore durante la verifica della e-mail.",
98 sprintf("E' occorso un errore durante la verifica della e-mail.<br><br>Codice d'errore: %d.<br>", $errcode));
100 $bdb->transaction('ROLLBACK');