CARIA.2.2

- Extention à 70 caractères l'adresse postale avec possibilitée d'ajouter des tirets
- Ajout d'une vérification dans l'ajout d'évènement si l'utilisateur éxiste
This commit is contained in:
ccunatbrule
2024-06-05 14:11:14 +02:00
parent e88f02fa95
commit 5ebf3df682
9 changed files with 22 additions and 14 deletions

2
.gitignore vendored
View File

@@ -1,4 +1,4 @@
Thumbs.db
.DS_Store
/config/connexion_sql.php
/module
config/connexion_sql.php

View File

@@ -2,7 +2,7 @@
// Connexion à la base de données
try
{
$bdd = new PDO('mysql:host=IP:3307;dbname=CARIA', 'USER', 'MDP',array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
$bdd = new PDO('mysql:host=nasccb:3307;dbname=CARIA', 'christian', 'fYUYWc5rSyC!',array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
}
catch(Exception $e)
{

Binary file not shown.

View File

@@ -103,12 +103,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$errors[] = "Le numéro de téléphone ne doit contenir que des chiffres.";
}
if (empty($localisation) || strlen($localisation) < 6 || strlen($localisation) > 50) {
$errors[] = "L'adresse postale est requise et doit contenir entre 6 et 50 caractères.";
if (empty($localisation) || strlen($localisation) < 6 || strlen($localisation) > 70) {
$errors[] = "L'adresse postale est requise et doit contenir entre 6 et 70 caractères.";
}
if (!preg_match('/^[A-Za-zÀ-ÖØ-öø-ÿ0-9 ]+$/', $localisation)) {
$errors[] = "L'adresse postale peut contenir uniquement des lettres, des chiffres et des espaces.";
if (!preg_match('/^[A-Za-zÀ-ÖØ-öø-ÿ0-9 -]+$/', $localisation)) {
$errors[] = "L'adresse postale peut contenir uniquement des lettres, des chiffres, des tirets et des espaces.";
}
if (preg_match('/^\s+$/', $localisation)) {

View File

@@ -84,12 +84,12 @@ function handleProfileModification() {
}
// Validation de l'adresse postale
if (empty($localisation) || strlen($localisation) < 6 || strlen($localisation) > 50) {
$errors[] = "L'adresse postale est requise et doit contenir entre 6 et 50 caractères.";
if (empty($localisation) || strlen($localisation) < 6 || strlen($localisation) > 70) {
$errors[] = "L'adresse postale est requise et doit contenir entre 6 et 70 caractères.";
}
if (!preg_match('/^[A-Za-zÀ-ÖØ-öø-ÿ0-9 ]+$/', $localisation)) {
$errors[] = "L'adresse postale peut contenir uniquement des lettres, des chiffres et des espaces.";
if (!preg_match('/^[A-Za-zÀ-ÖØ-öø-ÿ0-9 -]+$/', $localisation)) {
$errors[] = "L'adresse postale peut contenir uniquement des lettres, des chiffres, des tirets et des espaces.";
}
if (preg_match('/^\s+$/', $localisation)) {

View File

@@ -32,6 +32,14 @@ if ($stmtVehicule->fetchColumn() == 0) {
die(json_encode(['status' => 'error', 'message' => 'Le véhicule spécifié n\'existe pas.']));
}
// Vérification que l'ID du véhicule existe dans la base de données
$stmtUser = $bdd->prepare("SELECT COUNT(*) FROM Clients WHERE id = :id_user");
$stmtUser->bindParam(':id_user', $id_user, PDO::PARAM_INT);
$stmtUser->execute();
if ($stmtUser->fetchColumn() == 0) {
die(json_encode(['status' => 'error', 'message' => 'L\'utilisateur spécifié n\'existe pas.']));
}
// Validation des formats de date
if (!validateDateTime($start) || !validateDateTime($end)) {
die(json_encode(['status' => 'error', 'message' => 'Les dates doivent être dans un format valide (YYYY-MM-DD HH:MM:SS).']));

View File

@@ -16,7 +16,7 @@ CREATE TABLE Clients (
pseudo varchar(25),
prenom varchar(25) DEFAULT NULL,
nom varchar(25) DEFAULT NULL,
adresse varchar(50) DEFAULT NULL,
adresse varchar(70) DEFAULT NULL,
phone varchar(15) DEFAULT NULL,
email varchar(30) DEFAULT NULL,
mdp varchar(60) NOT NULL,

View File

@@ -28,7 +28,7 @@
<div class="mb-3 row">
<label for="localisation" class="col-sm-4 col-form-label">Adresse</label>
<div class="col-sm-8">
<input type="text" name="localisation" id="localisation" class="form-control" placeholder="Adresse" value="<?php echo stripslashes(htmlspecialchars($userData['adresse'])); ?>" autocomplete="street-address" minlength="6" maxlength="50" required />
<input type="text" name="localisation" id="localisation" class="form-control" placeholder="Adresse" value="<?php echo stripslashes(htmlspecialchars($userData['adresse'])); ?>" autocomplete="street-address" minlength="6" maxlength="70" required />
</div>
</div>
<div class="mb-3 row">

View File

@@ -42,7 +42,7 @@
</div>
<div class="form-group mb-3">
<label for="localisation" class="labelI">Adresse postale</label>
<input type="text" name="localisation" id="localisation" class="form-control" placeholder="Adresse" autocomplete="street-address" minlength="6" maxlength="50" value="<?php echo isset($_POST['localisation']) ? htmlspecialchars($_POST['localisation'], ENT_QUOTES, 'UTF-8') : ''; ?>" required title="Entrez votre adresse postale.">
<input type="text" name="localisation" id="localisation" class="form-control" placeholder="Adresse" autocomplete="street-address" minlength="6" maxlength="70" value="<?php echo isset($_POST['localisation']) ? htmlspecialchars($_POST['localisation'], ENT_QUOTES, 'UTF-8') : ''; ?>" required title="Entrez votre adresse postale.">
</div>
<fieldset class="mb-3"><br>
<div class="form-group">