protected function action() { $msg = new SysMsg(); $plan = new Unilevel(); $plan->setLevel(mysql_real_escape_string($_POST['level'])); $plan->setDescription(mysql_real_escape_string($_POST['desc'])); $mycomm = floatval(preg_replace("/[^-0-9\\.]/", ".", mysql_real_escape_string($_POST['comm']))); $plan->setCommission($mycomm); $redirect = 'user/fancymessage'; if ($plan->getLevel() > 0 && $plan->getDescription() != '' && $plan->getCommission() > 0) { if ($plan->save()) { $redirect = 'user/addplanunilevel'; } else { Session::setObj(Session::SYSMSG, $msg->setMessage('Inserimento piano Unilevel fallito.')->setType(SysMsg::MSG_CRITICAL)); } } else { Session::setObj(Session::SYSMSG, $msg->setMessage('Tutti i campi sono obbligatori. Inserimento piano Unilevel fallito.')->setType(SysMsg::MSG_CRITICAL)); } //*** $this->redirect = $redirect; }
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"; }
protected function action() { //Salvataggio nuovo avatar Utente $user = Session::getObj(Session::UTENTE); $msg = new SysMsg(); $avatar = new Avatar($_FILES["browse"]); $this->redirect = "user/adduseravatar"; $abort = 0; if (!($avatar->isValidType() && $avatar->isValidExtension())) { Session::setObj(Session::SYSMSG, $msg->setMessage('Formato file immagine non ammesso. [png - jpeg - gif]')->setType(SysMsg::MSG_ALERT)); $this->redirect = "user/fancymessage"; $abort = 1; } if (!$avatar->isValidSize()) { Session::setObj(Session::SYSMSG, $msg->setMessage('Dimensione file immagine non ammessa. [Max ' . Avatar::MAX_FILE_SIZE . ']')->setType(SysMsg::MSG_ALERT)); $this->redirect = "user/fancymessage"; $abort = 1; } if (!$avatar->noErrorDetected()) { Session::setObj(Session::SYSMSG, $msg->setMessage('Impossibile aprire il file immagine. Errore generico.')->setType(SysMsg::MSG_ALERT)); $this->redirect = "user/fancymessage"; $abort = 1; } if (!$abort) { $avatar->save($user->getId()); } }
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"; }
protected function action() { $msg = new SysMsg(); $sale = new Vendita(); $sale->setNetworker(mysql_real_escape_string($_POST['idntwrkr'])); $sale->setDateSale(mysql_real_escape_string($_POST['datepicker'])); $myamount = floatval(preg_replace("/[^-0-9\\.]/", ".", mysql_real_escape_string($_POST['importo']))); $sale->setAmount($myamount); if ($sale->getNetworker() > 0 && $sale->getDateSale() != '' && $sale->getAmount() > 0) { $sale->save() ? Session::setObj(Session::SYSMSG, $msg->setMessage('Inserimento nuova vendita avvenuto correttamente.')->setType(SysMsg::MSG_OK)) : Session::setObj(Session::SYSMSG, $msg->setMessage('Inserimento nuova vendita fallito.')->setType(SysMsg::MSG_CRITICAL)); } else { Session::setObj(Session::SYSMSG, $msg->setMessage('Tutti i campi sono obbligatori. Inserimento nuova vendita fallito.')->setType(SysMsg::MSG_CRITICAL)); } //*** $this->redirect = "user/fancymessage"; }
protected function action() { //Logout Utente $msg = new SysMsg(); Session::destroyObj(Session::UTENTE); Session::setObj(Session::SYSMSG, $msg->setMessage("Logout eseguito correttamente.")->setType(SysMsg::MSG_OK)); //*** $this->redirect = "user/message"; }
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"; }
protected function action() { $msg = new SysMsg(); $rdrct = "user/message"; if ($_POST['username'] != "" && $_POST['password'] != "") { //Autenticazione Utente $user = new Utente(); $user->setUsername(filter_var($_POST['username'], FILTER_SANITIZE_STRING)); $user->setPassword(filter_var($_POST['password'], FILTER_SANITIZE_STRING)); $user->login(); //Pone in sessione user (se autenticato)e message if ($user->isAutenticated()) { Session::setObj(Session::UTENTE, $user); Session::setObj(Session::SYSMSG, $msg->setMessage('Benvenuto ' . $user->getNome() . ' ' . $user->getCognome())->setType(SysMsg::MSG_OK)->addParameter('useravatar', $user->getAvatarUrl())); $rdrct = "user/welcome"; } else { Session::setObj(Session::SYSMSG, $msg->setMessage('Username/Password errati. Login fallito.')->setType(SysMsg::MSG_CRITICAL)); } } else { Session::setObj(Session::SYSMSG, $msg->setMessage('Username/Password non inseriti. Login fallito.')->setType(SysMsg::MSG_ALERT)); } //*** $this->redirect = $rdrct; }