1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
| <?php
require 'database.php';
$recherche = $seek = $affichage = null;
//--------------------------------------------------------FONCTIONS PHP-----------------------------------------------
function checkInput($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
// Générateur mot de passe -----------------------
function aleatoire($longueur = 5, $choix = "speciaux,chiffres,lettresmin,lettresmaj,tous")
{
$choix = explode(",", $choix);
$ChaineAutiliser = "";
$CaracteresSpeciaux = "~#{[|`$^@]*)\"^'}@^!:/.?,+-(";
foreach ($choix as $lechoix) {
switch ($lechoix) {
case "speciaux":
$ChaineAutiliser .= $CaracteresSpeciaux;
break;
case "chiffres":
$ChaineAutiliser .= "0123456789";
break;
case "lettresmin":
$ChaineAutiliser .= "abcdefghijklmnopqrstuvwxyz";
break;
case "lettresmaj":
$ChaineAutiliser .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
break;
case "tous":
$ChaineAutiliser = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" . $CaracteresSpeciaux;
break;
default:
$ChaineAutiliser .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //si le choix n'est pas bon, on met une chaine par défaut
}
}
$ChaineDeRetour = "";
for ($i = 1; $i <= $longueur; $i++) {
$ChaineDeRetour .= substr($ChaineAutiliser, rand(0, strlen($ChaineAutiliser) - 1), 1);
}
return $ChaineDeRetour;
}
//--------------------------------------------------------FIN FONCTIONS PHP-----------------------------------------------
?>
<!DOCTYPE html>
<html>
<head>
<title>Aqua-Cover Calculateur</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, , shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker.css" rel="stylesheet">
<link rel="stylesheet" href="../styles_aquacover.css">
<!-------------------------------------------------------DEBUT DES SCRIPTS------------------------------------------>
<!--Ajout d'un utilisateur-->
<script type="text/javascript">
function modal_add(add,code,nom) {
alert(code);
if (add == "add") {
document.getElementById("modal_window").setAttribute("style", "visibility:true");
document.getElementById("code_select").value = code;
document.getElementById("nom_select").value = nom;
}
}
</script>
</head>
<body>
<!-- Inputs cachés -->
<input type="text" hidden id="code_cache" value="">
<div class="container_header">
<img class="img-fluid.max-width: 100%" src="../Images-tempo/aquacover-premium%20(1).jpg" alt="" />
<div>
</div>
<div class="titre_header">
<img src="../Images/logo_aquacover.png" alt="" />
<p style="margin-top:-60px;">Gérer les utilisateurs</p>
</div>
</div>
<!--Menu principal -->
<div class="container container-navbar effect shift ">
<div class="row justify-content-center">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#"><i class="fa fa-fw fa-home fa-lg" style="color: blue"></i> <span class="font-navbar"> Home</span><span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="listDevis" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-fw fa-calculator fa-lg" style="color: blue"></i> <span class="font-navbar"> Devis</span>
</a>
<div class="dropdown-menu" aria-labelledby="listDevis">
<a class="dropdown-item" href="Liste-dv.php"><i class="fa fa-fw fa-clipboard-list fa-lg" style="color: grey"></i> Mes devis</a>
<!--<a class="dropdown-item" href="#"><i class="fa fa-fw fa-pencil-ruler fa-lg" style="color: grey"></i> Nouveau devis</a>-->
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="listAdministration" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-fw fa-cog fa-lg" style="color: blue"></i> <span class="font-navbar"> Administration</span></a>
<div class="dropdown-menu" aria-labelledby="listAdministration">
<a class="dropdown-item" href="../Admin/CSV/console.php"><i class="fa fa-fw fa-cloud-download-alt fa-lg" style="color: grey"></i> Mettre à jour les catalogues</a>
<a class="dropdown-item" href="#"><i class="fa fa-fw fa-pencil-ruler fa-lg" style="color: grey"></i> Autres</a>
</div>
</li>
</ul>
</div>
</nav>
</div>
</div>
<!-- Traitement de la recherche -->
<?php
$db = Database::connect();
if (isset($_POST['recherche']) and !empty($_POST['txt_recherche'])) {
$recherche = checkInput($_POST['recherche']);
$seek = checkInput($_POST['txt_recherche']);
switch ($recherche) {
case 'Afficher tout':
try {
$statement = $db->prepare("SELECT * FROM remise_distributeur WHERE calculateur='Non' ORDER BY code ASC");
$statement->execute();
$file = $statement->fetchall(PDO::FETCH_ASSOC);
$affichage = 'Pas de filtre appliqué';
} catch (Exception $e) {
echo "Une erreur est survenue lors de l'ouverture de la table remise_distributeur (user_add.php)";
}
break;
case 'Code':
try {
$statement = $db->prepare("SELECT * FROM remise_distributeur WHERE code LIKE ? ORDER BY code ASC");
$statement->execute(array("%" . $seek . "%"));
$file = $statement->fetchall(PDO::FETCH_ASSOC);
$affichage = 'Affichage des codes contenant ' . $seek;
} catch (Exception $e) {
echo "Une erreur est survenue lors de l'ouverture de la table remise_distributeur (user_add.php)";
}
break;
case 'Nom':
try {
$statement = $db->prepare("SELECT * FROM remise_distributeur WHERE nom LIKE ? ORDER BY nom ASC");
$statement->execute(array("%" . $seek . "%"));
$file = $statement->fetchall(PDO::FETCH_ASSOC);
$affichage = 'Affichage des noms contenant ' . $seek;
} catch (Exception $e) {
echo "Une erreur est survenue lors de l'ouverture de la table remise_distributeur (user_add.php)";
}
break;
}
} else {
try {
$statement = $db->prepare("SELECT * FROM remise_distributeur WHERE calculateur='Non' ORDER BY code ASC");
$statement->execute();
$file = $statement->fetchall(PDO::FETCH_ASSOC);
$affichage = 'Affichage de tous les distributeurs non membres.';
} catch (Exception $e) {
echo "Une erreur est survenue lors de l'ouverture de la table remise_distributeur (user_add.php)";
}
}
Database::disconnect();
?>
<div class="container " style="margin-top:30px; background-color:beige; border: silver 1px solid; border-radius:15px; padding:10px 0px 5px 20px">
<form action="" method="post">
<label for="recherche"><span style="margin-right:20px;font-style:italic;font-size:120%;">Rechercher : </span></label>
<select class="form-control-sm " style="width:auto; visibility:true" id="recherche" name="recherche" value="">
<option>Afficher tout</option>
<option>Code</option>
<option>Nom</option>
</select>
<input type="text" class="form-control-sm" style="margin-left:20px;width:200px" id="text_recherche" name="txt_recherche" value="" placeholder="Entrez votre recherche">
<span title="Entrez une partie du code ou du nom."><img src="..\Images\help-16.png" alt=""></span>
<input type="submit" class="btn btn-primary" style="margin-left: 20px; margin-bottom:2px;" value="Rechercher">
<?php
echo '<span style="margin-left:40px;font-style:italic;">' . $affichage . '</span>';
?>
</form>
</div>
<div class='container' style="position:relative;z-index:1">
<table class='table table-striped table-bordered table-hover' style="margin-top:30px;width:100%;font-size:90%;">
<thead>
<tr class="table-primary" style="font-size:100%;">
<th scope='col'>Numéro</th>
<th scope='col'>Nom</th>
<th scope='col'>Localité</th>
<th scope='col'>Pays</th>
<th style='text-align:center;width:345px' scope='col'>Actions</th>
</tr>
</thead>
<tbody>
<?php
$add = 'add';
foreach ($file as $row) {
$code = $row['code'];
$nom = $row['nom'];
echo (<<<html
<tr>
<td>$row['code']</td>
<td>$row['nom']</td>
<td>$row['cp'] $row['localite']</td>
<td>$row['pays']</td>
<td>
<a role="button" class="btn btn-primary" href="#" onclick="javascript:alert($nom);return false;" data-toggle="tooltip" title="Permettre l'accès à un utilisateur"><i class="fas fa-unlock"></i> Inscrire</a>
<a role="button" class="btn btn-danger" href="#" data-toggle="tooltip" title="Désactiver l'accès d'un utilisateur."><i class="fas fa-lock"></i> Annuler</a>
<a role="button" class="btn btn-success" href="#" data-toggle="tooltip" title="Modifier les accès d'un utilisateur."><i class="fas fa-edit"></i> Modifier</a>
</td>
</tr>
html
);
}
?>
</tbody>
</table>
<div class="container modal_window" style="visibility:hidden; " id="modal_window">
<form action="" method="post" style="padding-top:10px;padding-left:10px;">
<row class="container">
<col class="col-2">
<label for="code_select">Code : </label>
<?php
echo '<input type="text" readonly class="form-control-sm" id="code_select" name="code" value="">';
?>
</col>
<col class="col-8">
<label for="nom">Nom : </label>
<?php
echo '<input type="text" readonly class="form-control-sm" id="nom_select" name="nom" value="">';
?>
</col>
</row>
</form>
</div>
</div>
</body>
</html> |
Partager