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:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
Thumbs.db
|
Thumbs.db
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/config/connexion_sql.php
|
|
||||||
/module
|
/module
|
||||||
|
config/connexion_sql.php
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// Connexion à la base de données
|
// Connexion à la base de données
|
||||||
try
|
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)
|
catch(Exception $e)
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
@@ -103,12 +103,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$errors[] = "Le numéro de téléphone ne doit contenir que des chiffres.";
|
$errors[] = "Le numéro de téléphone ne doit contenir que des chiffres.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($localisation) || strlen($localisation) < 6 || strlen($localisation) > 50) {
|
if (empty($localisation) || strlen($localisation) < 6 || strlen($localisation) > 70) {
|
||||||
$errors[] = "L'adresse postale est requise et doit contenir entre 6 et 50 caractères.";
|
$errors[] = "L'adresse postale est requise et doit contenir entre 6 et 70 caractères.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^[A-Za-zÀ-ÖØ-öø-ÿ0-9 ]+$/', $localisation)) {
|
if (!preg_match('/^[A-Za-zÀ-ÖØ-öø-ÿ0-9 -]+$/', $localisation)) {
|
||||||
$errors[] = "L'adresse postale peut contenir uniquement des lettres, des chiffres et des espaces.";
|
$errors[] = "L'adresse postale peut contenir uniquement des lettres, des chiffres, des tirets et des espaces.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/^\s+$/', $localisation)) {
|
if (preg_match('/^\s+$/', $localisation)) {
|
||||||
|
|||||||
@@ -84,12 +84,12 @@ function handleProfileModification() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validation de l'adresse postale
|
// Validation de l'adresse postale
|
||||||
if (empty($localisation) || strlen($localisation) < 6 || strlen($localisation) > 50) {
|
if (empty($localisation) || strlen($localisation) < 6 || strlen($localisation) > 70) {
|
||||||
$errors[] = "L'adresse postale est requise et doit contenir entre 6 et 50 caractères.";
|
$errors[] = "L'adresse postale est requise et doit contenir entre 6 et 70 caractères.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^[A-Za-zÀ-ÖØ-öø-ÿ0-9 ]+$/', $localisation)) {
|
if (!preg_match('/^[A-Za-zÀ-ÖØ-öø-ÿ0-9 -]+$/', $localisation)) {
|
||||||
$errors[] = "L'adresse postale peut contenir uniquement des lettres, des chiffres et des espaces.";
|
$errors[] = "L'adresse postale peut contenir uniquement des lettres, des chiffres, des tirets et des espaces.";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preg_match('/^\s+$/', $localisation)) {
|
if (preg_match('/^\s+$/', $localisation)) {
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ if ($stmtVehicule->fetchColumn() == 0) {
|
|||||||
die(json_encode(['status' => 'error', 'message' => 'Le véhicule spécifié n\'existe pas.']));
|
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
|
// Validation des formats de date
|
||||||
if (!validateDateTime($start) || !validateDateTime($end)) {
|
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).']));
|
die(json_encode(['status' => 'error', 'message' => 'Les dates doivent être dans un format valide (YYYY-MM-DD HH:MM:SS).']));
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ CREATE TABLE Clients (
|
|||||||
pseudo varchar(25),
|
pseudo varchar(25),
|
||||||
prenom varchar(25) DEFAULT NULL,
|
prenom varchar(25) DEFAULT NULL,
|
||||||
nom varchar(25) DEFAULT NULL,
|
nom varchar(25) DEFAULT NULL,
|
||||||
adresse varchar(50) DEFAULT NULL,
|
adresse varchar(70) DEFAULT NULL,
|
||||||
phone varchar(15) DEFAULT NULL,
|
phone varchar(15) DEFAULT NULL,
|
||||||
email varchar(30) DEFAULT NULL,
|
email varchar(30) DEFAULT NULL,
|
||||||
mdp varchar(60) NOT NULL,
|
mdp varchar(60) NOT NULL,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
<label for="localisation" class="col-sm-4 col-form-label">Adresse</label>
|
<label for="localisation" class="col-sm-4 col-form-label">Adresse</label>
|
||||||
<div class="col-sm-8">
|
<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>
|
</div>
|
||||||
<div class="mb-3 row">
|
<div class="mb-3 row">
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group mb-3">
|
<div class="form-group mb-3">
|
||||||
<label for="localisation" class="labelI">Adresse postale</label>
|
<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>
|
</div>
|
||||||
<fieldset class="mb-3"><br>
|
<fieldset class="mb-3"><br>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
Reference in New Issue
Block a user