function afficher_collaborateur_externe($recherche) { //TODO:remettre correctement les liens... $query = "SELECT * FROM COLLABORATEUR C, EXTERNE E LEFT JOIN FOURNISSEUR F ON E.FOU_NO = F.FOU_NO WHERE E.COL_NO = C.COL_NO AND E.COL_NO = " . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); return creerFieldset('Identité :', afficher('Civilité :', $row['COL_CIVILITE'], 'span3', 'span3', false) . afficher('Prénom* :', $row['COL_PRENOM'], 'span3', 'span3', false) . sautLigne() . afficher('Nom* :', $row['COL_NOM'], 'span3', 'span3', false) . afficher('Nom de jeune fille :', $row['COL_NOMJEUNEFILLE'], 'span3', 'span3', false) . sautLigne() . afficher('Etat :', $row['COL_ETAT'] == 1 ? 'Actif' : 'Inactif', 'span3', 'span3', false) . afficher('Mnémonique* :', $row['COL_MNEMONIC'], 'span3', 'span3', false) . sautLigne() . afficher('Numéro de téléphone:', $row['COL_TEL'], 'span3', 'span3', false) . afficher('Numéro de téléphone portable*:', $row['COL_PRT'], 'span3', 'span3', false) . sautLigne() . afficher('E-mail :', $row['COL_EMAIL'], 'span3', 'span3', false) . afficher('Nom du fournisseur :', $row['FOU_NOM'], 'span3', 'span3', false) . sautLigne() . afficher('Archivé :', $row['COL_ARCHIVE'] == 1 ? 'Oui' : 'Non', 'span3', 'span3', false)); }
function afficher_modereglement($recherche) { $query = "SELECT * FROM MODEREGLEMENT WHERE MOR_NO=" . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); $result = afficher('Code : ', $row['MOR_CODE'], 'span3', 'span3', false) . sautLigne() . afficher('Libellé : ', $row['MOR_LIBELLE'], 'span3', 'span6', false) . sautLigne(); return $result; }
function afficher_banque($recherche) { $query = "SELECT * FROM BANQUE WHERE BAN_NO=" . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); $result = afficher('Nom de la banque : ', $row['BAN_NOM'], 'span3', 'span5', false) . sautLigne() . afficher('Code banque : ', $row['BAN_CDE_BAN'], 'span3', 'span3', false) . afficher('Code guichet : ', $row['BAN_CDE_GUI'], 'span3', 'span3', false) . sautLigne() . afficher('Numéro de compte banque : ', $row['BAN_NUM_CPT'], 'span3', 'span3', false) . afficher('Numéro de RIB : ', $row['BAN_RIB'], 'span3', 'span3', false); return $result; }
function afficher_entreprise($recherche) { $query = "SELECT * FROM ENTREPRISE WHERE ENT_NO=" . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); $result = afficher('Nom de l\'entreprise : ', $row['ENT_NOM'], 'span3', 'span3', false) . afficher('Statut : ', $row['ENT_STATUT'], 'span3', 'span3', false) . sautLigne() . afficher('Adresse : ', $row['ENT_ADRESSE'], 'span3', 'span3', false) . afficher('Complément d\'adresse : ', $row['ENT_ADRESSE_2'], 'span3', 'span3', false) . sautLigne() . afficher('Code postal : ', $row['ENT_CP'], 'span3', 'span3', false) . afficher('Numéro de téléphone : ', $row['ENT_TEL'], 'span3', 'span3', false) . sautLigne() . afficher('Ville : ', $row['ENT_VILLE'], 'span3', 'span3', false) . afficher('Capital : ', $row['ENT_CAPITAL'], 'span3', 'span3', false) . sautLigne() . afficher('Numéro de TVA intracommunautaire : ', $row['ENT_TVA_INTRA'], 'span3', 'span3', false) . afficher('Numéro du RCS : ', $row['ENT_RCS'], 'span3', 'span3', false) . sautLigne() . afficher('Numéro SIRET : ', $row['ENT_SIRET'], 'span3', 'span3', false) . afficher('Numéro APE : ', $row['ENT_APE'], 'span3', 'span3', false) . sautLigne() . afficher('Adresse web : ', $row['ENT_SITE_WEB'], 'span3', 'span3', false) . sautLigne() . afficher_image('Logo entête : ', $row['ENT_LOGO'], 'span3', 'span3', true) . afficher_image('Logo pied : ', $row['ENT_LOGOPIED'], 'span3', 'span3', true); return $result; }
function afficher_libdocument($recherche) { $query = "SELECT * FROM LIBDOCUMENT L LEFT JOIN COLLABORATEUR COL ON COL.COL_NO=L.COL_NO WHERE L.DOC_NO=" . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); return afficher('Document :', $row['LDO_DOCNO'], 'span2', 'span3') . afficher('No d\'ordre :', $row['LDO_ORDRE'], 'offset1 span2', 'span3') . sautLigne() . afficher('Intitulé :', $row['LDO_NOM'], 'span2', 'span3') . sautLigne() . afficher_textarea('Contenu :', $row['LDO_CONTENU'], 2, 8, 6, 80, 'textarea800'); return $result; }
function afficher_collaborateur_interne($recherche) { $query = "SELECT * FROM COLLABORATEUR C, INTERNE I LEFT JOIN FONCTION FCT ON FCT.FCT_NO=I.FCT_NO WHERE I.COL_NO = C.COL_NO AND I.COL_NO = " . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); $retour = creerFieldset('Identité :', afficher('Civilité :', $row['COL_CIVILITE'], 'span3', 'span3', false) . sautLigne() . afficher('Prénom* :', $row['COL_PRENOM'], 'span3', 'span3', false) . afficher('Nom* :', $row['COL_NOM'], 'span3', 'span3', false) . sautLigne() . afficher('Etat :', $row['COL_ETAT'] == 1 ? 'Actif' : 'Inactif', 'span3', 'span3', false) . afficher('Archivé :', $row['COL_ARCHIVE'] == 1 ? 'Oui' : 'Non', 'span3', 'span3', false) . sautLigne() . afficher('Mnémonique* :', $row['COL_MNEMONIC'], 'span3', 'span3', false) . afficher('Période d\'essai :', $row['INT_PERIODEESSAI'] == 1 ? 'Oui' : 'Non', 'span3', 'span3', false) . sautLigne() . afficher('Prolongation de la période d\'essai :', $row['INT_PPE'] == 1 ? 'Oui' : 'Non', 'span3', 'span3', false)); $retour .= creerFieldset('Coordonnées :', afficher('Adresse* :', $row['INT_ADRESSE'], 'span3', 'span3', false) . afficher('Adresse 2 :', $row['INT_ADRESSE2'], 'span3', 'span3', false) . sautLigne() . afficher('Code postal* :', $row['INT_CP'], 'span3', 'span3', false) . afficher('Ville* :', $row['INT_VILLE'], 'span3', 'span3', false) . sautLigne() . afficher('Numéro de téléphone :', $row['COL_TEL'], 'span3', 'span3', false) . afficher('Numéro de téléphone portable* :', $row['COL_PRT'], 'span3', 'span3', false) . sautLigne() . afficher('E-mail :', $row['COL_EMAIL'], 'span3', 'span3', false) . afficher('E-mail Apsaroke :', $row['COL_EMAILAPSA'], 'span3', 'span3', false)); $retour .= creerFieldset('Informations Complémentaires :', afficher('N° de sécurité sociale :', $row['INT_NSS'], 'span3', 'span3', false) . afficher('Date de naissance* :', format_date($row['INT_DTNAISSANCE']), 'span3', 'span3', false) . sautLigne() . afficher('Lieu de naissance* :', $row['INT_LIEUNAISSANCE'], 'span3', 'span3', false) . afficher('Nationalité :', $row['INT_NATIONALITE'], 'span3', 'span3', false)); $retour .= creerFieldset('Détails :', afficher('Date d\'entrée* :', format_date($row['INT_DTENTREE']), 'span3', 'span3', false) . afficher('Date de départ :', format_date($row['INT_DTDEPART']), 'span3', 'span3', false) . sautLigne() . afficher('Fonction :', $row['FCT_NOM'], 'span3', 'span3', false) . afficher('Statut :', $row['INT_STATUT'], 'span3', 'span3', false) . sautLigne() . afficher('Coefficient :', $row['INT_COEFF'], 'span3', 'span3', false) . afficher('Position :', $row['INT_POSITION'], 'span3', 'span3', false) . sautLigne() . afficher('Type de contrat :', $row['INT_TYPECONTRAT'], 'span3', 'span3', false) . afficher('Type d\'horaire :', $row['INT_TYPEHORAIRE'], 'span3', 'span3', false) . sautLigne() . afficher('Rémunération fixe annuelle (euros) :', $row['INT_REMUNFIXE'], 'span3', 'span3', false) . afficher('Rémunération variable annuelle (euros) :', $row['INT_REMUNVAR'], 'span3', 'span3', false) . sautLigne() . afficher('Frais journaliers (euros) :', $row['INT_FRAIS'], 'span3', 'span3', false)); $retour .= creerFieldset('Informations bancaires :', afficher('Nom de la banque :', $row['INT_NOMBANQUE'], 'span3', 'span3', false) . afficher('IBAN :', $row['INT_IBAN'], 'span3', 'span3', false) . sautLigne() . afficher('BIC :', $row['INT_BIC'], 'span3', 'span3', false)); $retour .= creerFieldset('Spécification collaborateur', afficher('Facturable :', $row['INT_FACTURABLE'] == 1 ? 'Oui' : 'Non', 'span3', 'span3', false) . afficher('Coût GSM (euros) :', $row['INT_GSM'], 'span3', 'span3', false) . sautLigne() . afficher('Treizième mois :', $row['INT_TREIZIEME'] == 1 ? 'Oui' : 'Non', 'span3', 'span3', false) . afficher('Coût PEE mensuel (euros) :', $row['INT_PEE'], 'span3', 'span3', false) . sautLigne() . afficher('Prime variable :', $row['INT_PART_VARI'] == 1 ? 'Oui' : 'Non', 'span3', 'span3', false) . afficher('Prime d\'ancienneté (euros) :', $row['INT_PRIME_ANCI'], 'span3', 'span3', false) . sautLigne() . afficher('Tickets restaurants :', $row['INT_TR'] == 1 ? 'Oui' : 'Non', 'span3', 'span3', false)); return $retour; }
function html_form() { global $myBD; $query = "SELECT idCategorie, nom FROM categories"; $resultat = $myBD->select($query); $isRechercher = isset($_GET['recherche']) && $_GET['recherche'] != '' ? afficher($_GET['recherche']) : 'Rechercher'; echo "\n <!--FORM-->\n <div class='container'>\n <form action='index.php' method='get' class='form-horizontal text-center' role='form'>\n <div class='form-group form-inline'>\n <label for='categories'>Recherche  </label>\n <select name='categories' id='categories' class='form-control' onchange='this.form.submit()'>\n <option value='0'>Catégories</option>"; foreach ($resultat as $key) { $isSelected = $_GET['categories'] == $key['idCategorie'] ? 'selected' : ''; echo "\n <option " . $isSelected . " value='" . $key['idCategorie'] . "'>" . $key['nom'] . "</option>"; } echo "\n </select>\n <input name='recherche' id='recherche' type='text' class='form-control' placeholder='" . $isRechercher . "' onchange='this.form.submit()' />\n <span class='btn btn-default glyphicon glyphicon-search hidden-xs'></span>\n </div>\n </form>\n </div>"; }
function update_BD() { global $categories_bd; global $categories_post; global $myBD; foreach ($categories_post as $key => $value) { $query = "UPDATE categories\n SET nom = '" . $value['nom'] . "'\n WHERE idCategorie = " . $value['idCategorie']; $res = $myBD->update($query); } if (!empty($_POST['ajoutCategorie'])) { $query = "INSERT INTO categories (nom) VALUES ('" . afficher($_POST['ajoutCategorie']) . "')"; $myBD->insert($query); } }
function afficher_client($recherche) { $query = "SELECT * FROM CLIENT WHERE CLI_NO='" . $recherche . "'"; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); $contenu = null; $image = null; if (isset($row['CLI_LOGO'])) { $contenu = $row['CLI_LOGO']; $image = true; } else { $contenu = 'Ce client n\'a pas de logo'; $image = false; } return creerFieldset('Identité :', afficher('Code client :', $row['CLI_CODE'], 'span3', 'span3', false) . sautLigne() . afficher('Début de collaboration :', format_date($row['CLI_DTCREATION']), 'span3', 'span3', false) . afficher('Etat du client :', $row['CLI_ARCHIVE'] == 1 ? 'Archivé' : 'Actif', 'span3', 'span3') . sautLigne() . afficher('', '<b>Informations commerciales</b>', 'span2', 'span4', false) . afficher('', '<b>Informations facturation</b>', 'span2', 'span4', false) . sautLigne() . afficher('Nom :', $row['CLI_NOM'], 'span3', 'span3', false) . afficher('Nom de facturation :', $row['CLI_NOMFAC'], 'span3', 'span3', false) . sautLigne() . afficher('1ère adresse :', $row['CLI_ADRCOM_1'], 'span3', 'span3', false) . afficher('1ère adresse :', $row['CLI_ADRFAC_1'], 'span3', 'span3', false) . sautLigne() . afficher('2ème adresse :', $row['CLI_ADRCOM_2'], 'span3', 'span3', false) . afficher('2ème adresse :', $row['CLI_ADRFAC_2'], 'span3', 'span3', false) . sautLigne() . afficher('Code postal :', $row['CLI_CPCOM'], 'span3', 'span3', false) . afficher('Code postal :', $row['CLI_CPFAC'], 'span3', 'span3', false) . sautLigne() . afficher('Ville :', $row['CLI_VILLECOM'], 'span3', 'span3', false) . afficher('Ville :', $row['CLI_VILLEFAC'], 'span3', 'span3', false) . sautLigne() . afficher('Pays :', $row['CLI_PAYS'], 'span3', 'span3', false) . afficher('Code fournisseur :', $row['CLI_CODE_FOUR'], 'span3', 'span3', false) . sautLigne() . afficher_image('Logo du client :', $contenu, 'span3', 'span3', $image)); }
function afficher_projet($recherche, $idmission = 0) { $query = "SELECT P.*, CLI_NOM, CTC_NOM, COL.COL_PRENOM AS COL_PRENOM, COL.COL_NOM AS COL_NOM, COM.COL_PRENOM AS COM_PRENOM, COM.COL_NOM AS COM_NOM FROM PROJET P LEFT JOIN COLLABORATEUR COL ON COL.COL_NO=P.COL_NO LEFT JOIN COLLABORATEUR COM ON COM.COL_NO=P.PRO_SUIVIPAR, CONTACT_CLIENT CTC, CLIENT C WHERE C.CLI_NO=P.CLI_NO AND CTC.CTC_NO=P.CTC_NO AND P.PRO_NO=" . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); // Mission : par défaut, c'est la dernière mission if (!isset($idmission) || $idmission == 0 || $idmission == null) { $query = "SELECT MIS_NO FROM MISSION WHERE PRO_NO=" . $row['PRO_NO'] . " AND MIS_ORDRE IN (SELECT MAX(MIS_ORDRE) FROM MISSION WHERE PRO_NO=" . $row['PRO_NO'] . ")"; $results = $GLOBALS['connexion']->query($query)->fetch_assoc(); $idmission = $results['MIS_NO']; } $q2 = "SELECT * FROM MISSION WHERE MIS_NO=" . $idmission; $row2 = $GLOBALS['connexion']->query($q2)->fetch_assoc(); $cloture = ""; if ($row2['MIS_ARCHIVE'] > 0) { $cloture = afficher('<b>Mission ARCHIVEE</b>', '', 'span2', 'span3'); } if (is_null($row['CTF_NO'])) { $row['CTF_NOM'] = "Aucun"; } else { $qctc = "SELECT CTF_NOM FROM CONTACT_FOURNISSEUR WHERE CTF_NO =" . $row['CTF_NO']; $row['CTF_NOM'] = $GLOBALS['connexion']->query($qctc)->fetch_assoc(); } if ($row2['MIS_NSEQUENTIEL'] != '') { // recherche de l'id de l'historique pour la ré-impression $q1 = "SELECT * FROM HISTDOC WHERE HID_TYPE='OMI' AND HID_IDDOC=" . $idmission; $r1 = $GLOBALS['connexion']->query($q1)->fetch_assoc(); $iddoc = $r1['HID_NO']; $NSEQ = button('', 'MIS_NSEQUENTIEL', $row2['MIS_NSEQUENTIEL'], 1, 3, $classe = '', $clsinput = 'btn btn-primary', $link = 'javascript:reimpOMI(' . $row['PRO_NO'] . ', ' . $iddoc . ');'); } else { $NSEQ = button('', 'MIS_NSEQUENTIEL', 'Ordre de Mission', 1, 3, $classe = '', $clsinput = 'btn btn-primary', $link = 'javascript:impOMI(' . $row2['MIS_NO'] . ');'); $PRO_NO = '<input type="hidden" name="PRO_NO" value="' . $row2['PRO_NO'] . '">'; } $det = str_replace('\\n', '', $row['PRO_DETAIL']); $det = str_replace('\\r', '<br />', $det); $result = creerFieldset('Projet', array(afficher('Client :', $row['CLI_NOM'], 'span3', 'span3'), afficher('Nom du projet :', $row['PRO_NOM'], 'span3', 'span3'), sautLigne(), afficher('Contact client :', $row['CTC_NOM'], 'span3', 'span3'), afficher('Partenaire éventuel :', $row['CTF_NOM'], 'span3', 'span3'), sautLigne(), afficher('Début du projet :', format_date($row['PRO_DTDEBUT']), 'span3', 'span3'), afficher('Numéro de cde :', $row['PRO_NUMCMDE'], 'span3', 'span3'), sautLigne(), afficher('Collaborateur :', $row['COL_PRENOM'] . ' ' . $row['COL_NOM'], 'span3', 'span3'), afficher('Projet suivi par :', $row['COM_PRENOM'] . ' ' . $row['COM_NOM'], 'span3', 'span3'), sautLigne(), afficher('Durée prévisionnelle (jours) :', $row['PRO_NBJOURS'], 'span3', 'span3'), afficher('Date de fin prévue :', format_date($row['PRO_DTFINPREVUE']), 'span3', 'span3'), sautLigne(), afficher_textarea('Détails :', $row['PRO_DETAIL'], 3, 8, 1, 80, 'textarea800'), sautLigne(), afficher_textarea('Modalités :', $row['PRO_MODALITE'], 3, 8, 4, 80, 'textarea800'), sautLigne(), afficher('Etat du projet :', $row['PRO_ARCHIVE'] == 1 ? 'Archivé' : 'En cours', 'span3', 'span3'), afficher('Date de cloture :', format_date($row['PRO_DTCLOTURE']), 'span3', 'span3'), sautLigne(), '<div style="border-top: 1px solid #e5e5e5; width: 98%; margin-left: 30px;"><div>')); $result .= creerFieldset('Mission', array(select('<b>Mission :</b>', 'MISSION', array() + donner_liste('MISSION', 'MIS', 0, $idmission), 3, 3, false, $idmission), $cloture, sautLigne(), afficher('Nom de la mission :', $row2['MIS_NOM'], 'span3', 'span3'), $NSEQ, $PRO_NO, sautLigne(), afficher('Numéro de cde :', $row2['MIS_NUMCMDE'], 'span3', 'span3'), afficher('Date de cde :', $row2['MIS_DATECMDE'], 'span3', 'span3'), sautLigne(), afficher('Début de mission :', $row2['MIS_DTDEBUT'], 'span3', 'span3'), afficher('Fin de mission :', $row2['MIS_DTFIN'], 'span3', 'span3'), sautLigne(), afficher('Durée prévisionnelle (jours):', $row2['MIS_NBJOURS'], 'span3', 'span3'), sautLigne(), afficher('Forfait :', $row2['MIS_FORFAIT'] == 1 ? 'Oui' : 'Non', 'span3', 'span3'), afficher('Montant du forfait :', $row2['MIS_MONTFORFAIT'], 'span3', 'span3'), sautLigne(), afficher('Taux journalier :', $row2['MIS_TJM'], 'span3', 'span3'), afficher('Prix d\'achat :', $row2['MIS_PA'], 'span3', 'span3'), sautLigne(), afficher_textarea('Commentaire :', $row2['MIS_COMMENTAIRE'], 3, 8, 4, 80, 'textarea800'), input('', 'idmission', 2, 3, true, 'hidden'))); return $result; }
<?php $login = $_SESSION['user']; $user = afficher($login);
<?php require "../modele/scoreBDD.php"; if (isset($_REQUEST['nom'])) { enregister(); afficher(); } else { $temps = $_GET['orderid']; print "<center class='style'>Votre temps est {$temps} secondes</center>"; require "../vue/score.html"; } function enregister() { $nom = $_GET['nom']; $temps = $_GET['temps']; if ($nom != null) { scoreBDD($nom, $temps); } else { echo "<div class='style'>"; echo "<p>Veuillez entrer un pseudo</p>"; echo "</div>"; } require "../vue/score.html"; } function afficher() { if ($score = afficherBDD() and isset($score)) { toString($score); } else { echo "erreur de la base"; } }
function afficherConfirmation() { global $myBD; $ins = "\n UPDATE Clients\n SET motDePasse = '" . escape($_POST['motDePasseNouveau']) . "'\n WHERE nomUsager = '" . escape($_SESSION['authentification']) . "'"; $myBD->update($ins); $nbr_changements = mysqli_affected_rows($myBD->BDInterne); echo "\n <div class='width-sm text-center'>\n <h1>"; echo afficher($_SESSION['authentification']); echo "\n </h1><br>\n <h3>"; echo $nbr_changements === 0 ? 'Aucun changement.' : 'Votre dossier a été mis à jour avec succès.'; echo "\n </h3><br><br>\n <a class='btn btn-default' href='index.php'>Retourner au catalogue</a>\n </div>"; }
function afficher_contact_client($recherche) { $query = "SELECT * FROM CONTACT_CLIENT CTC LEFT JOIN FONCTION FC ON CTC.FCT_NO = FC.FCT_NO, CLIENT C WHERE CTC.CLI_NO = C.CLI_NO AND CTC_NO=" . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); return afficher('Nom du client :', $row['CLI_NOM'], 'span3', 'span3') . afficher('Nom du contact :', $row['CTC_NOM'], 'span3', 'span3') . sautLigne() . afficher('Prénom du contact :', $row['CTC_PRENOM'], 'span3', 'span3') . afficher('E-mail du contact :', $row['CTC_EMAIL'], 'span3', 'span3') . sautLigne() . afficher('No de téléphone portable :', $row['CTC_PRT'], 'span3', 'span3') . afficher('Fonction du contact :', $row['FCT_NOM'], 'span3', 'span3') . sautLigne() . afficher('Etat du contact :', $row['CTC_ARCHIVE'] == 1 ? 'Archivé' : 'Actif', 'span3', 'span3') . sautLigne() . afficher('Commentaire :', $row['CTC_COMMENTAIRE'], 'span3', 'span3'); }
function profil($id) { //On vérifie que le paramètre est bien un ID if ($id != null && $id == intval($id) && Consultation::exists($id)) { //Gestion du POST if (isset($_POST['posted'])) { } //Inclusion de la page $rdv = Consultation::select($id); $tabMedecin = Medecin::selectAll(); $tabPatient = Patient::selectAll(); $pConsult = Patient::select($rdv['id_patient']); $mConsult = Medecin::selectByID($rdv['id_medecin']); include VIEW . 'modifierConsultation.php'; } else { unset($_POST); //Supprimer le post pour éviter les conflits avec l'autre page afficher(); echo "<p id='mErreur'>Aucune consultation correspondante<p>"; } }
$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();
function afficher_fonction($recherche) { $query = "SELECT * FROM FONCTION WHERE FCT_NO=" . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); return afficher('Libellé :', $row['FCT_NOM'], 'span3', 'span3') . sautLigne(); }
//------------------------------------------------------------------------------ // index.php // Maxim Hébert // 5/19/2016 //------------------------------------------------------------------------------ global $root; $root = '..'; require_once "{$root}/biblio/foncCommunes.php"; session_start(); if (isset($_SESSION['administrateur'])) { header("location:index.php"); exit; } $erreur = ''; if (isset($_POST['valider'])) { $query = "SELECT *\n FROM administrateurs\n WHERE nom = '" . afficher($_POST['nomAdmin']) . "' AND motDePasse = '" . md5(afficher($_POST['motDePasse'])) . "'"; $res = $myBD->select($query); if (!empty($res)) { $_SESSION['administrateur'] = afficher($res[0]['nom']); header("location:index.php"); exit; } else { $erreur = "<span class='text-danger erreur glyphicon glyphicon-warning-sign pull-right'><span> Non valide.</span></span>"; } } html_header_admin(); html_sideMenu_admin("authentification"); echo "\n <form action='authentification.php' method='post' id='authentification' class='form form-horizontal width-sm' role='form'>\n <h1>Authentification administrateur</h1><br><br>\n <div class='form-group'>\n <label class='control-label col-sm-3' for='prenom'>Nom d'administrateur :</label>\n <div class='col-sm-9'>\n <input class='form-control' type='text' name='nomAdmin' id='nomAdmin'>\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 </form>"; echo "<link href='../css/MonMagasin.css' rel='stylesheet' type='text/css'>"; html_footer_admin();
function afficher_contact_fournisseur($recherche) { $query = "SELECT * FROM CONTACT_FOURNISSEUR CTF LEFT JOIN FONCTION FC ON CTF.FCT_NO = FC.FCT_NO, FOURNISSEUR F WHERE CTF.FOU_NO = F.FOU_NO AND CTF_NO = " . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); return afficher('Nom du fournisseur :', $row['FOU_NOM'], 'span3', 'span3') . afficher('Nom du contact :', $row['CTF_NOM'], 'span3', 'span3') . sautLigne() . afficher('Prénom du contact :', $row['CTF_PRENOM'], 'span3', 'span3') . afficher('E-mail du contact :', $row['CTF_EMAIL'], 'span3', 'span3') . sautLigne() . afficher('No de téléphone portable :', $row['CTF_PRT'], 'span3', 'span3') . afficher('Fonction du contact :', $row['FCT_NOM'], 'span3', 'span3') . sautLigne() . afficher('Etat du contact :', $row['CTF_ARCHIVE'] == 1 ? 'Archivé' : 'Actif', 'span3', 'span3') . sautLigne() . afficher('Commentaire :', $row['CTF_COMMENTAIRE'], 'span3', 'span3'); }
<?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();
function afficher_fournisseur($recherche) { $query = "SELECT * FROM FOURNISSEUR WHERE FOU_NO=" . $recherche; $row = $GLOBALS['connexion']->query($query)->fetch_assoc(); return afficher('Code fournisseur :', $row['FOU_CODE'], 'span3', 'span3') . afficher('Nom du fournisseur :', $row['FOU_NOM'], 'span3', 'span3') . sautLigne() . afficher('Date de début de collaboration :', format_date($row['FOU_DTCREATION']), 'span3', 'span3') . afficher('Etat du fournisseur :', $row['FOU_ARCHIVE'] == 1 ? 'Archivé' : 'Actif', 'span3', 'span3'); }
function afficherChamp($type, $label, $key) { global $client; echo "\n <!-- {$key} -->\n <div class='form-group'>\n <label class='control-label col-sm-3' for='{$key}'>{$label} :</label>\n <div class='col-sm-9'>"; // Cas particulié pour le genre if ($key == "genre") { echo "<label class='col-sm-4 radio'>Homme <input type='radio' name='{$key}' id='homme' value='h'"; if (isset($client->genre) && $client->genre != 'f' || !isset($clien->genre)) { echo 'checked'; } echo "></label>"; echo "<label class='col-sm-4 radio'>Femme <input type='radio' name='{$key}' id='femme' value='f'"; if (isset($client->genre) && $client->genre == 'f') { echo 'checked'; } echo "></label>"; // Cas particulié pour la province } elseif ($key == "province") { echo "<select class='col-sm-6 form-control' name='province'>"; afficherProvinces($client->province); echo "</select>"; // Tout les autres champs } else { echo "\n <input class='col-sm-6 form-control' type='{$type}' name='{$key}' id='{$key}'"; if (isset($client->{$key})) { echo "value='" . afficher($client->{$key}) . "'"; } // Si c'est le nom de l'usager if ($key == "nomUsager") { echo " onblur='validerUnicite()'"; // S'il est authentifier if (isset($_SESSION['authentification'])) { echo ' READONLY'; } } echo '>'; } ajouterMessageErreur("{$key}"); // Si le nom d'usager est déjà utilisé if (isset($_GET['erreur']) && ($_GET['erreur'] = "doublon" && $key == "nomUsager")) { echo "<span class='text-danger erreur col-sm-6 glyphicon glyphicon-warning-sign'> Doublon.</span>"; } echo "\n </div>\n </div>"; }
<?php //------------------------------------------------------------------------------ // creationDossier.php // Maxim Hébert // 22/03/2016 //------------------------------------------------------------------------------ require_once "biblio/foncCommunes.php"; session_start(); global $myBD; $client = new Client($_SESSION['client']); $_SESSION['authentification'] = afficher($client->nomUsager); $ins = "INSERT INTO Clients\n(nom, prenom, genre, adresse, courriel, ville, province, codePostal, numeroTelephone, nomUsager, motDePasse)\nVALUES\n(\n '{$client->nom}',\n '{$client->prenom}',\n '{$client->genre}',\n '{$client->adresse}',\n '{$client->courriel}',\n '{$client->ville}',\n '{$client->province}',\n '{$client->codePostal}',\n '{$client->numeroTelephone}',\n '{$client->nomUsager}',\n '{$client->motDePasse}'\n);"; try { $myBD->insert($ins); } catch (Exception $e) { header("location:inscription.php?erreur=doublon"); exit; } html_header(); html_sideMenu(''); echo "\n <!-- Confirmation de la création du dossier -->\n <div class='width-sm'>\n <h1>{$client->prenom} {$client->nom}</h1>\n <h2>Votre dossier a été créé avec succès et dorénavant vous êtes inscrit sur notre site.</h2>\n <p>À votre prochaine visite, il vous suffira de vous authentifier avec votre nom d'usager: {$client->nomUsager} et votre mot de passe.</p>\n <p>Pour cette session, vous êtes déjà authentifié.</p>\n <a class='btn btn-default pull-right' href='index.php'>Retourner au catalogue</a>\n </div>"; html_footer();