function inscription() { $erreur_array = array('name' => -1, 'description' => -1, 'contenu' => -1, 'from' => -1, 'to' => -1); $erreur = false; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $array_user = $this->postLogin($erreur, $erreur_array); $nb = $this->userExist(array('email' => $array_user['user']['email'])); if (!$erreur && !$nb) { $array_user['user']['is_verified'] = uniqid(); $userDao = new UserDao(new User($array_user['user'])); $userDao->create(); //die(var_dump($array_services)); $iduser = $userDao->getLastID(); $array_user['adresse']['id_user'] = $iduser; $adresseDao = new AdresseDao(new Adresse($array_user['adresse'])); $adresseDao->create(); $mail = new Mail(); $result = $mail->sendMailActivation('*****@*****.**', $array_user['user']['email'], $array_user['user']['prenom'], $array_user['user']['is_verified']); if ($result['send']) { $this->set(array('success' => '1')); $this->render('inscription'); } } elseif ($nb) { $this->set(array('success' => '2')); $this->render('inscription'); } elseif ($erreur) { $this->render('inscription'); } } $this->set(array('success' => '0')); $this->render('inscription'); }
function modifier_profil($params) { $erreur_array = array('name' => -1, 'description' => -1, 'contenu' => -1, 'from' => -1, 'to' => -1); $erreur = false; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $params = $_POST['iduser']; $array_user = $this->postModifier_user($erreur, $erreur_array); if (!$erreur) { $userDao = new UserDao(new User($array_user['user'])); $userDao->update($params); $array_user['adresse']['id_user'] = $params; $adresseDao = new AdresseDao(new Adresse($array_user['adresse'])); $adresseDao->update($params); $this->redirect('authentification/profil/' . $params); /* $mail = new Mail(); $result = $mail->sendMailActivation('*****@*****.**', $array_user['user']['email'], $array_user['user']['prenom'],$array_user['user']['is_verified']); if($result['send']){ $this->set(array('success'=>'1')); $this->render('inscription'); }*/ } } $adresseDao = new AdresseDao(new Adresse()); $adresse = $adresseDao->getRow(array('id_user' => $params)); $this->set(array('adresse' => $adresse, 'profession' => $this->getUser()->getProfession(), 'secteur' => $this->getUser()->getDomaine())); $this->render('modifier_profil'); }