<?php require 'conf/conf-admin.php'; if (empty($_GET['id']) && !isset($_GET['id'])) { Utils::redirect('index-admin.php'); } else { $detail = DetailsManager::getDetailsByIdCommande($_GET['id']); $totalHT = 0; foreach ($detail as $details) { $totalHT += round($details->getMontant(), 2); } $commande = CommandesManager::getCommandesById($_GET['id']); } echo $twig->render('detail-admin.twig', array('commandes' => CommandesManager::getCommandesById($_GET['id']), 'utilisateurs' => UtilisateursManager::getUtilisateursById($commande->getIdUtilisateur()), 'articles' => ArticlesManager::getArticlesById($_GET['id']), 'details' => DetailsManager::getDetailsByIdCommande($_GET['id']), 'totalHT' => $totalHT));
} if (empty($_POST['emailSignIn2'])) { $controle->add('Veuillez confirmez votre adresse email', 'emailSignIn2'); } if ($_POST['emailSignIn'] != $_POST['emailSignIn2']) { $controle->add('Les adresses email ne sont pas identiques', 'emailNotSame'); } if ($controle->isEmpty()) { $codeClientSignIn = $_POST['codeClientSignIn']; $emailSignIn = $_POST['emailSignIn']; $customer = UtilisateursManager::getUtilisateurByCodeClientAndEmail($codeClientSignIn, $emailSignIn); if ($customer) { # fonction d'envoie de mot de passe par mail. $password = Utils::random(); $customer->setMotDePasse(sha1($password)); UtilisateursManager::updateUtilisateurs($customer); $mail = Mail::inscription($customer, $password); if ($mail) { Utils::json(array('result' => 'success', 'email' => $emailSignIn)); } else { tils::json(array('result' => 'errorSendMail')); } } else { $controle->add('Code client ou adresse email invalide', 'invalideSignIn'); Utils::json(array('result' => 'error', 'data' => $controle->getAll())); } } else { Utils::json(array('result' => 'error', 'data' => $controle->getAll())); } break; }
<?php require 'conf/conf.php'; define('PAGE', 'INFORMATIONS'); require 'conf/conf_page.php'; $error = ""; if (isset($_POST['submit'])) { $customer = UtilisateursManager::getUtilisateursById($_SESSION['customer']['idClient']); $customer->setIdUtilisateur($_SESSION['customer']['idClient']); $customer->setAdresse($_POST['adresse']); $customer->setNom($_POST['company']); $customer->setPrenom($_POST['prenom']); $customer->setCodePostal($_POST['cp']); $customer->setTelephone($_POST['telephone']); $customer->setEmail($_POST['email']); if (isset($_POST['mdp']) && $_POST['mdp'] != '') { $customer->setMotDePasse(sha1($_POST['mdp'])); } $customer->setVille($_POST['ville']); if ($_POST['mdp'] == $_POST['mdp2']) { UtilisateursManager::updateUtilisateurs($customer); } else { $error = 'les mots de passe ne sont pas indetiques '; } } echo $twig->render('informations.twig', array('PAGE' => $_PAGE, 'articles' => ArticlesManager::getAllArticles(), 'customer' => UtilisateursManager::getUtilisateursById($_SESSION['customer']['idClient']), 'error' => $error && $error != "" ? $error : false));
<?php require 'conf/conf.php'; define('PAGE', 'CONTACT'); require 'conf/conf_page.php'; $sentMail = 'sentmail'; if (!empty($_POST)) { if (isset($_POST['submit'])) { $controle = new Errors(); if (empty($_POST['email'])) { $controle->add('Veuillez saisir votre e-mail', 'email'); } if (empty($_POST['name'])) { $controle->add('Veuillez saisir votre nom', 'name'); } if (empty($_POST['message'])) { $controle->add('Veuillez saisir votre message', 'message'); } if ($controle->isEmpty()) { $sentMessage = new Mail(); $customer = UtilisateursManager::getUtilisateursById($_SESSION['customer']['idClient']); $sentMail = $sentMessage->Contact($customer); if ($sentMail) { $sentMail = 'send'; } } } } echo $twig->render('contact.twig', array('PAGE' => $_PAGE, 'controle' => isset($controle) && !empty($controle) ? $controle : null, 'POST' => isset($_POST) && !empty($_POST) ? $_POST : '', 'send' => $sentMail));
if (!empty($_SESSION['customer']['utilisateur']) && !empty($_SESSION['customer']['motDePasse'])) { Utils::redirect('home'); } if (!empty($_POST)) { if (isset($_POST['submit'])) { $controle = new Errors(); if (empty($_POST['codeClient'])) { $controle->add('Veuillez saisir votre code client', 'codeClient'); } if (empty($_POST['motDePasse'])) { $controle->add('Veuillez saisir votre mot de passe', 'motDePasse'); } if ($controle->isEmpty()) { $utilisateur = $_POST['codeClient']; $motDePasse = $_POST['motDePasse']; $customer = UtilisateursManager::getUtilisateurByCodeClientAndPassword($utilisateur, $motDePasse); if ($customer) { $_SESSION['customer']['idClient'] = $customer->getIdUtilisateur(); $_SESSION['customer']['codeClient'] = $customer->getCodeClient(); $_SESSION['customer']['codeClient'] = $customer->getCodeClient(); $_SESSION['customer']['motDePasse'] = $customer->getMotDePasse(); $_SESSION['customer']['nom'] = $customer->getNom(); $_SESSION['customer']['prenom'] = $customer->getPrenom(); $_SESSION['customer']['email'] = $customer->getEmail(); $_SESSION['customer']['telephone'] = $customer->getTelephone(); $_SESSION['customer']['adresse'] = $customer->getAdresse(); $_SESSION['customer']['codePostal'] = $customer->getCodePostal(); $_SESSION['customer']['ville'] = $customer->getVille(); $_SESSION['customer']['teleprospecteur'] = $customer->getTeleprospecteur(); $_SESSION['customer']['teleprospecteur'] == '1' ? Utils::redirect('backoffice/index-admin.php') && define('ADMIN_REQUIRE', TRUE) : Utils::redirect('home'); } else {
<?php require 'conf/conf.php'; if (empty($_GET['id']) && !isset($_GET['id'])) { Utils::redirect('home'); } else { $detail = DetailsManager::getDetailsByIdCommande($_GET['id']); $totalHT = 0; foreach ($detail as $details) { $totalHT += round($details->getMontant(), 2); } } echo $twig->render('detail.twig', array('commandes' => CommandesManager::getCommandesById($_GET['id']), 'utilisateurs' => UtilisateursManager::getUtilisateursById($_SESSION['customer']['idClient']), 'articles' => ArticlesManager::getArticlesById($_GET['id']), 'details' => DetailsManager::getDetailsByIdCommande($_GET['id']), 'totalHT' => $totalHT));