Version stable, aprelic, connexion CFRS et autres corrections

This commit is contained in:
Oleg Barykin committed 2026-04-17 20:18:11 +02:00
1 parent 865de8a976
commit e9d0010451
62 files changed
+17483 -7256

No files matched your search

+48 -46
View File
@@ -1,19 +1,20 @@
<?php
require_once __DIR__ . '/../includes/init_client.php';
require_once __DIR__ . '/../includes/init_client.php';
$id = (int)($_SESSION['reference_id'] ?? 0);
if (!$id) { http_response_code(403); exit($translations['client_introuvable'] ?? 'Client introuvable'); }
$id = (int) ($_SESSION['reference_id'] ?? 0);
if (! $id) {http_response_code(403);exit($translations['client_introuvable'] ?? 'Client introuvable');}
// Récupérer les données du client
$stmt = $pdo->prepare("SELECT * FROM client WHERE id = ?");
$stmt->execute([$id]);
$client = $stmt->fetch();
if (!$client) {
// Récupérer les données du client
$stmt = $pdo->prepare("SELECT * FROM client WHERE id = ?");
$stmt->execute([$id]);
$client = $stmt->fetch();
if (! $client) {
exit($translations['client_introuvable'] ?? 'Client introuvable');
}
}
// ---- Traitement du formulaire AVANT tout output ----
if (($_SERVER['REQUEST_METHOD'] ?? '') === 'POST') {
// ---- Traitement du formulaire AVANT tout output ----
if (($_SERVER['REQUEST_METHOD'] ?? '') === 'POST') {
require_post_csrf();
$nom = trim($_POST['nom'] ?? '');
$prenom = trim($_POST['prenom'] ?? '');
$telephone = trim($_POST['telephone'] ?? '');
@@ -30,84 +31,85 @@ if (($_SERVER['REQUEST_METHOD'] ?? '') === 'POST') {
WHERE id=:id
");
$stmt->execute([
'nom' => $nom,
'prenom' => $prenom,
'telephone' => $telephone,
'genre' => $genre,
'nom' => $nom,
'prenom' => $prenom,
'telephone' => $telephone,
'genre' => $genre,
'date_naissance' => $date_naiss ?: null,
'adresse' => $adresse,
'ville' => $ville,
'code_postal' => $cp,
'id' => $id
'adresse' => $adresse,
'ville' => $ville,
'code_postal' => $cp,
'id' => $id,
]);
// redirection (évite le repost + actualise la page infos)
header('Location: /public/client/informations.php?updated=1');
exit;
}
require_once __DIR__ . '/../includes/header.php';
}
require_once __DIR__ . '/../includes/header.php';
?>
<div class="main1">
<div class="container py-5">
<form method="POST" class="shadow p-4 rounded bg-light">
<h2 class="mb-4 text-center"><?= $translations['modifier_infos_heading'] ?></h2>
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars(ensure_csrf_token(), ENT_QUOTES, 'UTF-8') ?>">
<h2 class="mb-4 text-center"><?php echo $translations['modifier_infos_heading'] ?></h2>
<div class="mb-3">
<label class="form-label"><?= $translations['label_nom'] ?> *</label>
<input type="text" name="nom" value="<?= htmlspecialchars($client['nom'] ?? '') ?>" required class="form-control">
<label class="form-label"><?php echo $translations['label_nom'] ?> *</label>
<input type="text" name="nom" value="<?php echo htmlspecialchars($client['nom'] ?? '') ?>" required class="form-control">
</div>
<div class="mb-3">
<label class="form-label"><?= $translations['label_prenom'] ?> *</label>
<input type="text" name="prenom" value="<?= htmlspecialchars($client['prenom'] ?? '') ?>" required class="form-control">
<label class="form-label"><?php echo $translations['label_prenom'] ?> *</label>
<input type="text" name="prenom" value="<?php echo htmlspecialchars($client['prenom'] ?? '') ?>" required class="form-control">
</div>
<div class="mb-3">
<label class="form-label"><?= $translations['label_telephone'] ?> *</label>
<input type="tel" name="telephone" id="telephone" value="<?= htmlspecialchars($client['telephone'] ?? '') ?>" class="form-control" placeholder="+33600000000"
<label class="form-label"><?php echo $translations['label_telephone'] ?> *</label>
<input type="tel" name="telephone" id="telephone" value="<?php echo htmlspecialchars($client['telephone'] ?? '') ?>" class="form-control" placeholder="+33600000000"
required
pattern="^\+?[1-9]\d{6,14}$"
title="<?=htmlspecialchars($translations['telephone_format_message']?? '') ?>">
title="<?php echo htmlspecialchars($translations['telephone_format_message'] ?? '') ?>">
</div>
<div class="mb-3">
<label class="form-label"><?= $translations['label_genre'] ?></label>
<label class="form-label"><?php echo $translations['label_genre'] ?></label>
<select name="genre" class="form-select">
<option value=""><?= $translations['select_selectionnez'] ?></option>
<option value="<?= $translations['genre_homme'] ?>" <?= $client['genre'] === $translations['genre_homme'] ? 'selected' : '' ?>><?= $translations['genre_homme'] ?></option>
<option value="<?= $translations['genre_femme'] ?>" <?= $client['genre'] === $translations['genre_femme'] ? 'selected' : '' ?>><?= $translations['genre_femme'] ?></option>
<option value="<?= $translations['genre_autre'] ?>" <?= $client['genre'] === $translations['genre_autre'] ? 'selected' : '' ?>><?= $translations['genre_autre'] ?></option>
<option value=""><?php echo $translations['select_selectionnez'] ?></option>
<option value="<?php echo $translations['genre_homme'] ?>" <?php echo $client['genre'] === $translations['genre_homme'] ? 'selected' : '' ?>><?php echo $translations['genre_homme'] ?></option>
<option value="<?php echo $translations['genre_femme'] ?>" <?php echo $client['genre'] === $translations['genre_femme'] ? 'selected' : '' ?>><?php echo $translations['genre_femme'] ?></option>
<option value="<?php echo $translations['genre_autre'] ?>" <?php echo $client['genre'] === $translations['genre_autre'] ? 'selected' : '' ?>><?php echo $translations['genre_autre'] ?></option>
</select>
</div>
<div class="mb-3">
<label class="form-label"><?= $translations['label_date_naissance'] ?></label>
<input type="date" name="date_naissance" value="<?= htmlspecialchars($client['date_naissance'] ?? '') ?>" class="form-control">
<label class="form-label"><?php echo $translations['label_date_naissance'] ?></label>
<input type="date" name="date_naissance" value="<?php echo htmlspecialchars($client['date_naissance'] ?? '') ?>" class="form-control">
</div>
<div class="mb-3 input-wrapper">
<label class="form-label"><?= $translations['label_adresse'] ?></label>
<textarea name="adresse" id="adresse" class="form-control"><?= htmlspecialchars($client['adresse'] ?? '') ?></textarea>
<label class="form-label"><?php echo $translations['label_adresse'] ?></label>
<textarea name="adresse" id="adresse" class="form-control"><?php echo htmlspecialchars($client['adresse'] ?? '') ?></textarea>
<ul id="suggestions" class="list-group position-absolute"></ul>
</div>
<div class="mb-3">
<label class="form-label"><?= $translations['label_ville'] ?></label>
<input type="text" name="ville" id="ville" value="<?= htmlspecialchars($client['ville'] ?? '') ?>" class="form-control">
<label class="form-label"><?php echo $translations['label_ville'] ?></label>
<input type="text" name="ville" id="ville" value="<?php echo htmlspecialchars($client['ville'] ?? '') ?>" class="form-control">
</div>
<div class="mb-4">
<label class="form-label"><?= $translations['label_code_postal'] ?></label>
<input type="text" name="code_postal" id="code_postal" value="<?= htmlspecialchars($client['code_postal'] ?? '') ?>" class="form-control">
<label class="form-label"><?php echo $translations['label_code_postal'] ?></label>
<input type="text" name="code_postal" id="code_postal" value="<?php echo htmlspecialchars($client['code_postal'] ?? '') ?>" class="form-control">
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary"><?= $translations['btn_mettre_a_jour'] ?></button>
<button type="submit" class="btn btn-primary"><?php echo $translations['btn_mettre_a_jour'] ?></button>
</div>
<?= $translations['champs_obligatoire'] ?>
<?php echo $translations['champs_obligatoire'] ?>
</form>
</div>
@@ -217,7 +219,7 @@ document.addEventListener("DOMContentLoaded", function () {
</div>
<footer class="site-footer">
<div class="container">
<p><?= $translations['copyr'] ?></p>
<p><?php echo $translations['copyr'] ?></p>
</div>
</footer>
</body>