Example #1
0
 protected function action()
 {
     $userMail = filter_var($_POST['email'], FILTER_SANITIZE_STRING);
     $msg = new SysMsg();
     if ($this->checkEmailAddress($userMail)) {
         $user = new Utente();
         $user->setEmail($userMail);
         $pwd = $user->getForgottenPassword();
         if ($pwd != '') {
             $msg = 'Salve, abbiamo recuperato la sua password: '******'Servizio');
             $mail->setCognome('Support');
             $mail->setEmailFrom('*****@*****.**');
             $mail->setEmailTo($userMail);
             $mail->setEmailReplyTo('*****@*****.**');
             $mail->setOggetto('Recupero password.');
             $mail->setMessaggio($msg);
             $mail->sendMail();
             Session::setObj(Session::SYSMSG, $msg->setMessage('La password &egrave stata inviata a: ' . $userMail)->setType(SysMsg::MSG_OK));
         } else {
             Session::setObj(Session::SYSMSG, $msg->setMessage('Spiacente, non siamo riusciti a recuperare la sua password.')->setType(SysMsg::MSG_CRITICAL));
         }
     } else {
         Session::setObj(Session::SYSMSG, $msg->setMessage('Spiacente, email errata.')->setType(SysMsg::MSG_ALERT));
     }
     //***
     $this->redirect = "message";
 }
Example #2
0
 protected function action()
 {
     //Autenticazione Utente
     $msg = new SysMsg();
     $user = new Utente();
     $user->setParent(mysql_real_escape_string($_POST['parent']));
     $user->setNome(mysql_real_escape_string(ucfirst($_POST['nome'])));
     $user->setCognome(mysql_real_escape_string(ucfirst($_POST['cognome'])));
     $user->setEmail(mysql_real_escape_string($_POST['email']));
     $user->setUsername(mysql_real_escape_string($_POST['username']));
     $user->setPassword(mysql_real_escape_string($_POST['password']));
     if ($user->getNome() != '' && $user->getCognome() != '' && $user->getEmail() != '' && $user->getUsername() != '' && $user->getPassword() != '') {
         if ($user->save()) {
             $user->login();
             //Pone in sessione user (se autenticato)e message
             if ($user->isAutenticated()) {
                 Session::setObj(Session::UTENTE, $user);
             }
             //***
             Session::setObj(Session::SYSMSG, $msg->setMessage('Inserimento utente avvenuto correttamente.')->setType(SysMsg::MSG_OK));
         } else {
             Session::setObj(Session::SYSMSG, $msg->setMessage('Inserimento utente fallito.')->setType(SysMsg::MSG_CRITICAL));
         }
     } else {
         Session::setObj(Session::SYSMSG, $msg->setMessage('Tutti i campi sono obbligatori. Inserimento utente fallito.')->setType(SysMsg::MSG_ALERT));
     }
     //***
     $this->redirect = "user/fancymessage";
 }
Example #3
0
 protected function action()
 {
     //Autenticazione Utente
     $msg = new SysMsg();
     $user = new Utente(Session::getObj(Session::NETWORKER)->getId());
     $user->setNome(filter_var(ucfirst($_POST['nome']), FILTER_SANITIZE_STRING));
     $user->setCognome(filter_var(ucfirst($_POST['cognome']), FILTER_SANITIZE_STRING));
     $user->setEmail(filter_var($_POST['email'], FILTER_SANITIZE_STRING));
     $user->setUsername(filter_var($_POST['username'], FILTER_SANITIZE_STRING));
     $user->setPassword(filter_var($_POST['password'], FILTER_SANITIZE_STRING));
     $user->update() ? Session::setObj(Session::SYSMSG, $msg->setMessage("Utente aggiornato correttamente.")->setType(SysMsg::MSG_OK)) : Session::setObj(Session::SYSMSG, $msg->setMessage("Aggiornamento utente fallito.")->setType(SysMsg::MSG_CRITICAL));
     //***
     Session::destroyObj(Session::NETWORKER);
     $this->redirect = "user/fancymessage";
 }
Example #4
0
 protected function action()
 {
     //Autenticazione Utente
     $msg = new SysMsg();
     $user = new Utente(Session::getObj(Session::UTENTE)->getId());
     $user->setNome(filter_var($_POST['nome'], FILTER_SANITIZE_STRING));
     $user->setCognome(filter_var($_POST['cognome'], FILTER_SANITIZE_STRING));
     $user->setEmail(filter_var($_POST['email'], FILTER_SANITIZE_STRING));
     $user->setUsername(filter_var($_POST['username'], FILTER_SANITIZE_STRING));
     $user->setPassword(filter_var($_POST['password'], FILTER_SANITIZE_STRING));
     if ($user->update()) {
         //Pone in sessione user
         Session::setObj(Session::UTENTE, $user);
         Session::setObj(Session::SYSMSG, $msg->setMessage("Utente aggiornato correttamente.")->setType(SysMsg::MSG_OK));
     } else {
         Session::setObj(Session::SYSMSG, $msg->setMessage("Aggiornamento utente fallito.")->setType(SysMsg::MSG_CRITICAL));
     }
     //***
     $this->redirect = "user/fancymessage";
 }
 function modificaCliente($cod, $cod2, $nome, $data, $email, $telefono, $username, $password)
 {
     $cliente = new Utente();
     if ($cod == "" || $cod2 == "" || $nome == "" || $data == "" || $email == "" || $telefono == "" || $username == "" || $password == "") {
         return null;
     }
     $query = "SELECT * FROM utente WHERE codiceFiscale='{$cod}' and tipo='cliente'";
     $this->database->query($query);
     $res = $this->database->result;
     $riga = mysql_fetch_array($res);
     if (isset($riga[0])) {
         $cliente->setCodice($cod2);
         $cliente->setNome($nome);
         $cliente->setDataNascita($data);
         $cliente->setEmail($email);
         $cliente->setTelefono($telefono);
         $cliente->setUsername($username);
         $cliente->setPassword($password);
         $cliente->setTipo("cliente");
         $cliente->update($cod);
         return $cliente;
     } else {
         return null;
     }
 }