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
| <?php
session_start();
include "db.php";
include "Validation/vendor/autoload.php";
use Respect\Validation\Validator as v;
if (isset($_POST)) {
$objet = new stdClass();
$objet->nom = $_POST["nom"];
$objet->prenom = $_POST["prenom"];
$objet->email = $_POST["email"];
$objet->postale = $_POST["postale"];
$objet->ville = $_POST["ville"];
$objet->identifiant = $_POST["identifiant"];
$objet->pass = $_POST["pass"];
$objet->relation = $_POST["relation"];
$objet->recherche = $_POST["recherche"];
$objet->taille = $_POST["taille"];
$objet->poid = $_POST["poid"];
$objet->fumeur = $_POST["fumeur"];
$objet->comment = $_POST["comment"];
$valid = v::attribute('email', v::email()->notEmpty()->setName('Email'))
->attribute('postale', v::numeric()->notEmpty()->setName('Postale'))
->attribute('ville', v::alpha()->notEmpty()->setName('Ville'))
->attribute('identifiant', v::alnum()->notEmpty()->setName('Identifiant'))
->attribute('pass', v::alnum()->notEmpty()->setName('Pass'))
->attribute('relation', v::numeric()->notEmpty()->setName('relation'))
->attribute('recherche', v::numeric()->notEmpty()->setName('recherche'))
->attribute('taille', v::numeric()->notEmpty()->setName('taille'))
->attribute('poid', v::numeric()->notEmpty()->setName('poid'))
->attribute('fumeur', v::numeric()->notEmpty()->setName('fumeur'))
->attribute('comment', v::alnum()->notEmpty()->setName('comment'));
echo $bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo error_reporting( E_ALL );
var_dump($valid, $objet);
// try {
// $valid->assert($objet);
// $st = $bdd->prepare('UPDATE membres SET nom=:nom, prenom=:prenom, email=:email, postale=:postale, ville=:ville, pass=:pass WHERE identifiant=:identifiant ');
// $st->execute([':nom' => $objet->nom, ':prenom' => $objet->prenom, ':email' => $objet->email, ':postale' => $objet->postale, ':ville' => $objet->ville, ':pass' => $objet->pass, ':identifiant' => $objet->identifiant]);
//
// $st = $bdd->prepare("INSERT INTO membres_info_compl (relation, recherche, taille, poid, fumeur, comment) VALUES (?,?,?,?,?,?) ");
// $st->execute(array($objet->relation, $objet->recherche, $objet->taille, $objet->poid,$objet->fumeur, $objet->comment));
//
//
//
//// $_SESSION['data'] = $_POST;
////
//// header('location:accueil.php');
////
// } catch (\InvalidArgumentException $e) {
//
// $objet->error = $e->findMessages([
// 'notEmpty' => '{{name}} veuillez remplir ce champ'
// , 'alnum' => '{{name}} Que des chiffres et des lettres',
// 'email' => ' Votre email est incorrecte',
// 'alpha' => '{{name}} ne peut contenir que des lettres',
// 'numeric' => '{{name}} que des chiffres',
//
//
// ]);
//// $_SESSION['error'] = $objet->error;
//// $_SESSION['data'] = $_POST;
////
//// //header('location:Mon_profil.php');
// }
}
?> |
Partager