示例#1
0
文件: index.php 项目: maxeber/eshop
<?php

//------------------------------------------------------------------------------
// index.php
// Maxim Hébert
// 25/02/2016
//------------------------------------------------------------------------------
global $root;
$root = '.';
require_once "{$root}/biblio/foncCommunes.php";
session_start();
global $myBD;
html_header();
html_sideMenu('catalogue');
html_form();
html_catalogue();
echo "\n    <!-- Modal -->\n    <div class='modal fade in' id='myModal' role='dialog'>\n        <div class='modal-dialog'>\n\n            <!-- Modal content-->\n            <div class='modal-content'></div>\n\n        </div>\n    </div>";
html_footer();
示例#2
0
<?php

//------------------------------------------------------------------------------
// updateDossier.php
// Maxim Hébert
// 22/03/2016
//------------------------------------------------------------------------------
global $root;
$root = '.';
require_once "biblio/foncCommunes.php";
session_start();
html_header();
html_sideMenu('');
global $myBD;
$client = new Client($_SESSION['client']);
$ins = "UPDATE Clients\n        SET nom = '" . escape($client->nom) . "',\n            prenom = '" . escape($client->prenom) . "',\n            genre = '" . escape($client->genre) . "',\n            adresse = '" . escape($client->adresse) . "',\n            courriel = '" . escape($client->courriel) . "',\n            ville = '" . escape($client->ville) . "',\n            province = '" . escape($client->province) . "',\n            codePostal = '" . escape($client->codePostal) . "',\n            numeroTelephone = '" . escape($client->numeroTelephone) . "'\n        WHERE nomUsager = '" . escape($_SESSION['authentification']) . "';";
$myBD->update($ins);
// Nombre de ligne qui ont été modifiées
$nbr_changements = mysqli_affected_rows($myBD->BDInterne);
echo "\n        <!-- Confirmation de la création du dossier -->\n        <div class='width-sm text-center'>\n                <h1>" . afficher($client->prenom) . " " . afficher($client->nom) . "</h1><br>\n                <h3>" . ($nbr_changements === 0 ? 'Aucun changement.' : 'Votre dossier a été mis à jour avec succès.') . "</h3>\n                <br><br>\n                <a class='btn btn-default' href='index.php'>Retourner au catalogue</a>\n        </div>";
html_footer();
示例#3
0
$commandesPassees = array();
if (isset($_SESSION['client'])) {
    $client = $_SESSION['client'];
    recupCommandes();
    if (isset($_GET['quoiFaire'])) {
        if ($_GET['quoiFaire'] === 'annuler') {
            annulerCommande($_GET['id']);
            recupCommandes();
        }
    }
} else {
    header("location:authentification.php?provenance=commandesPassees");
    exit;
}
html_header();
html_sideMenu("historique");
echo "\n    <div class='width-sm'>\n        <h1>Historique des commandes</h1>\n        <p class='text-info small'>Vous avez passé un total de " . count($commandesPassees) . " commande(s)</p>\n        <br>";
foreach ($commandesPassees as $key => $value) {
    $commande = $commandesPassees[$key];
    $panier = $commande['achats'];
    $date = $commande['dateCommande'];
    echo "\n        <h3>Commande : " . $commande['idCommande'] . "</h3>\n        <p class='small'>{$date}</p>\n        <table class='table table-responsive table-striped table-hover'>\n            <thead>\n                <tr>\n                    <th colspan='2 sortable both asc'>Nom de l'article</th>\n                    <th>Quantité</th>\n                    <th class='text-right'>Prix</th>\n                    <th></th>\n                </tr>\n            </thead>\n            <tbody>";
    foreach ($panier as $key => $value) {
        $produit = $value['infosProduit'];
        echo "\n            <!-- 'table-row' contenant un produit -->\n            <tr>\n                <td colspan='2'>" . $produit['nom'] . "</td>\n                <td>" . $value['quantite'] . "</td>\n                <td class='text-right'>" . number_format($produit['prix'] * $value['quantite'], 2) . "&nbsp\$</td>\n                <td>\n                </td>\n            </tr>";
    }
    echo "\n            </tbody>\n        </table>";
    afficherAnnulation($commande['idCommande']);
}
echo "</div>";
html_footer();
示例#4
0
<?php

//------------------------------------------------------------------------------
// confirmerPanier.php
// Maxim Hébert
// 22/03/2016
//------------------------------------------------------------------------------
global $root;
$root = '.';
require_once "biblio/foncCommunes.php";
session_start();
global $myBD;
if (isset($_SESSION['authentification'])) {
    $panier = new Panier();
    html_header();
    html_sideMenu("");
    echo "<div class='col-xs-12 col-sm-8 col-sm-offset-2'>";
    if ($panier->getNbAchats() == 0) {
        echo "<br><h3 class='text-center'>Votre commande d'achats est vide.</h3>";
    } else {
        $panier->afficherCommandes();
        $panier->afficherFacture();
        echo "\n            <p class='pull-right'>\n                <a href='panierGestion.php' class='btn btn-default'>Modifier la commande</a>\n                <a href='carteCredit.php' class='btn btn-success'>Commander</a>\n            </p>";
    }
    echo "</div>";
} else {
    header("location:authentification.php?provenance=confirmerPanier");
    exit;
}
html_footer();
示例#5
0
//------------------------------------------------------------------------------
// authentification.php
// Maxim Hébert
// 22/03/2016
//------------------------------------------------------------------------------
global $root;
$root = '.';
require_once "biblio/foncCommunes.php";
session_start();
global $myBD;
$client = $_SESSION['client'];
$toutValide = true;
$erreurs = array();
recupContext();
html_header();
html_sideMenu("motDePasse");
if ($toutValide) {
    afficherConfirmation();
} else {
    afficherForm();
}
html_footer();
//------------------------------------------------------------------------------
// recupContext
//------------------------------------------------------------------------------
function recupContext()
{
    global $toutValide;
    global $erreurs;
    global $myBD;
    $motDePasse = $myBD->select("SELECT motDePasse FROM clients WHERE nomUsager = '" . $_SESSION['authentification'] . "'");
示例#6
0
    $res = $myBD->select($query);
    if (!empty($res)) {
        $client = new Client($res[0]);
        $_SESSION['client'] = $client;
        $_SESSION['authentification'] = afficher($client->nomUsager);
    } else {
        $erreur = "<span class='text-danger erreur glyphicon glyphicon-warning-sign pull-right'><span> Non valide.</span></span>";
    }
}
if (isset($_SESSION['authentification'])) {
    if (isset($_GET['provenance'])) {
        switch ($_GET['provenance']) {
            case 'monDossier':
                header("location:inscription.php");
                exit;
                break;
            case 'confirmerPanier':
                header("location:confirmerPanier.php");
                exit;
                break;
        }
    } else {
        header("location:index.php");
        exit;
    }
}
html_header();
html_sideMenu("authentification");
$provenance = isset($_GET['provenance']) ? "?provenance=" . afficher($_GET['provenance']) : '';
echo "\n        <form action='authentification.php{$provenance}' method='post' id='authentification' class='form form-horizontal width-sm' role='form'>\n            <h1>Authentification</h1><br><br>\n            <div class='form-group'>\n                <label class='control-label col-sm-3' for='prenom'>Nom d'usager :</label>\n                <div class='col-sm-9'>\n                    <input class='form-control' type='text' name='nomUsager' id='nomUsager'>\n                </div>\n            </div>\n            <div class='form-group'>\n                <label class='control-label col-sm-3' for='motDePasse'>Mot de passe :</label>\n                <div class='col-sm-9'>\n                    <input class='form-control' type='password' name='motDePasse' id='motDePasse'>\n                    {$erreur}\n                </div>\n            </div>\n            <input class='btn btn-primary pull-right submit' type='submit' name='valider' value='Se connecter'>\n            <a id='creerDossier' class='btn btn-success col-xs-6 col-xs-offset-3' href='inscription.php'>Créer un dossier</a>\n        </form>";
html_footer();
示例#7
0
<?php

//------------------------------------------------------------------------------
// politique.php
// Maxim Hébert
// 25/02/2016
//------------------------------------------------------------------------------
global $root;
$root = '.';
require_once "biblio/foncCommunes.php";
session_start();
html_header();
html_sideMenu('politique');
echo "\n    <div class='container width-sm'>\n        <h1>Nos Politiques</h1><br>\n        <p>Comme notre catalogue vous offre des articles variés, notre inventaire varie grandement.</p>\n        <p>Notre catalogue reflète l'état de notre inventaire dans la mesure du possible mais nous ne pouvons garantir la disponibilité de tous les articles.</p>\n        <br>\n\n        <h3>Nous acceptons les cartes</h3>\n        <p>Visa, Mastercard et American Express</p>\n        <br>\n        <p>En raison de notre type de produits, et sauf dans les cas de problèmes majeurs, nous n'acceptons ni les retours ni les échanges.</p>\n        <p>Par contre, vous disposez de deux jours pour annuler toute commande. Passé ce délai, vos articles vous sont envoyés et le montant total de la transaction est affecté à votre carte de crédit.</p>\n        <br><br><br>\n        <h3 class='text-center'>Merci de votre clientèle!</h3>\n        <br>\n    </div>";
html_footer();