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.
27 ini_set("max_execution_time", "240");
29 require_once($G_base."Obj/brisk.phh");
30 require_once($G_base."Obj/user.phh");
31 require_once($G_base."Obj/auth.phh");
32 require_once($G_base."Obj/dbase_${G_dbasetype}.phh");
33 require_once($G_base."Obj/singlemsg.phh");
35 require_once($G_base."spush/brisk-spush.phh");
37 define('MAILMGR_CHECKMAIL', 1);
40 // GLOBAL $G_dbpfx, $G_alarm_passwd, $f_mailusers, $sess, $_POST, $_SERVER;
41 GLOBAL $G_dbpfx, $f_act, $f_code, $f_hash;
43 /* echo "act: $f_act<br>";
44 echo "code: $f_code<br>";
45 echo "hash: $f_hash<br>"; */
47 if ($f_act == "checkmail") {
50 if (($bdb = BriskDB::create()) == FALSE) {
51 log_crit("stat-day: database connection failed");
55 $bdb->transaction('BEGIN');
57 if (($mai = $bdb->mail_check($f_code, MAILMGR_CHECKMAIL, $f_hash)) == FALSE) {
62 if (($bdb->user_update_flag_ty($mai->ucode, USER_FLAG_TY_DISABLE,
63 TRUE, USER_DIS_REA_NU_MAILED,
64 TRUE, USER_DIS_REA_NU_TOBECHK)) == FALSE) {
69 if (($mai = $bdb->mail_delete($f_code)) == FALSE) {
73 $bdb->transaction('COMMIT');
75 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!");
79 if ($errcode == 10002) {
80 singlemsg("L'email è già stata verificata con successo.",
81 "L'email è già stata verificata con successo, ora attenda che le venga recapitata la password.");
84 singlemsg("E' occorso un errore durante la verifica della e-mail.",
85 sprintf("E' occorso un errore durante la verifica della e-mail.<br><br>Codice d'errore: %d.<br>", $errcode));
87 $bdb->transaction('ROLLBACK');