/* * Description : Page de gestion des utilisateur + Liste + Modification * Auteur : * Date création : 01/02/2003 * Editeur : * */ include ("../include/ErrorManager.php") ; include ("../include/class_bd_sql.inc.php") ; include ("../include/fct_html.inc.php") ; include ("../include/fct_sqlserver.inc.php") ; include ("../include/fct_regexp.inc") ; include ("../include/config.php"); include ("../include/fonctions_mysql.php"); include ("../include/TDBObject.php"); oOpenConnection(); $connection = new TDBObject(); $DestructionOk = 0; $TabListeProduitUtil = 0; // Protection $RechercheUT = ""; if (isset($HTTP_POST_VARS['Search'])) $RechercheUT = $HTTP_POST_VARS['Search']; $CodeALE = ""; if (isset($HTTP_POST_VARS['CodeAleatoire'])) $CodeALE = $HTTP_POST_VARS['CodeAleatoire']; /* TRAITEMENT FORMULAIRE */ if (isset($HTTP_POST_VARS['FormAction'])) { $FormAction = $HTTP_POST_VARS['FormAction'] ; if ($FormAction == 'SelectUtil') $CurUtil = $HTTP_POST_VARS['SelectUtil'] ; elseif ($FormAction == 'GoToUtil') $CurUtil = $HTTP_POST_VARS['IdUtil'] ; // Destruction if (substr($FormAction,0,7) == 'DelUser') { $CurUtil = substr($FormAction,8,strlen($FormAction) - 8); $QueryDelete = "DELETE FROM utilisateur WHERE id_utilisateur = $CurUtil;"; $connection->fExecQuery($QueryDelete) ; $DestructionOk = 1; } // Recherche if (trim($HTTP_POST_VARS['Search']) != "" && ($FormAction == 'GoToUtil' || $FormAction == 'Search')) { // SEARCH $ptSearch = new TDBObject(); $bSearch = true ; $StrSearch = SqlServerQuote(trim($HTTP_POST_VARS['Search'])) ; $QuerySearch = "SELECT id_utilisateur, nom, prenom FROM utilisateur WHERE (nom LIKE '%$StrSearch%' OR prenom LIKE '%$StrSearch%' OR email LIKE '%$StrSearch%') ORDER BY LOWER(nom);" ; $ptSearch->fExecQuery($QuerySearch) ; } } if ($DestructionOk == 0) if (isset($CurUtil) && $CurUtil != '#') { $QueryInfo = "SELECT * FROM utilisateur WHERE id_utilisateur = $CurUtil;" ; $connection->fExecQuery($QueryInfo) ; $Trouve = $connection->fGetNumRows(); $TabInfo = $connection->fGetNextRecord() ; $connection->oFreeResult() ; if ($Trouve > 0) { if (isset($TabInfo)) array_walk($TabInfo, "ArrayToFormQuote") ; // Recuperation de tous les produits deposes par un utilisateur $QueryUtilProduit = "SELECT id_produit,reference,libelle,prix_euro,valide,expire "; $QueryUtilProduit .= "FROM produit WHERE id_utilisateur=".$CurUtil; $connection->fExecQuery($QueryUtilProduit); $TabListeProduitUtil = array(); $cpt = 0; while ($champs = $connection->fGetNextRecord()) { $TabListeProduitUtil[$cpt][0] = $champs["id_produit"]; $TabListeProduitUtil[$cpt][1] = DbToFormQuote($champs["reference"]); $TabListeProduitUtil[$cpt][2] = DbToFormQuote($champs["libelle"]); $TabListeProduitUtil[$cpt][3] = $champs["prix_euro"]; $TabListeProduitUtil[$cpt][4] = $champs["valide"]; $TabListeProduitUtil[$cpt][5] = $champs["expire"]; $cpt++; } $connection->oFreeResult(); } } // INFO /* FIN TRAITEMENT FORMULAIRE */ /* TEMPLATE */ // Select Utilisateur $QueryUtil = "SELECT id_utilisateur, titre, nom, prenom FROM utilisateur ORDER BY LOWER(nom), LOWER(prenom);" ; $connection->fExecQuery($QueryUtil) ; $TabSelect = array() ; $cpt = 0; while ($champs = $connection->fGetNextRecord()) { $TabSelect[$cpt][0] = $champs["id_utilisateur"]; $TabSelect[$cpt][1] = ucwords($champs["titre"]); $TabSelect[$cpt][2] = ucwords($champs["nom"]); $TabSelect[$cpt][3] = ucwords($champs["prenom"]); $cpt++; } $connection->oFreeResult(); $AffichageSelectUtilisateur = ""; $AffichageSelectUtilisateur .= ""; $ListeProduitUtilisateur = ""; if (isset($CurUtil) && $CurUtil != '#') { if (count($TabListeProduitUtil)==0) { $ListeProduitUtilisateur .= "