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
| <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Inscription</title>
</head>
<body>
<?php
include_once 'config.php';
if(isset($_POST)&& isset($_POST['civilite']) && isset($_POST['nom']) && isset($_POST['prenom']) && isset($_POST['adresse'])
&& isset($_POST['cplad'])&& isset($_POST['etage'])&& isset($_POST['porte'])&& isset($_POST['ville'])&& isset($_POST['codepostal'])&& isset($_POST['mail']) && isset($_POST['phone']) && isset($_POST['password']) && isset($_POST['pwd1'])){
if(get_magic_quotes_gpc()){
$_POST['civilite'] = stripslashes(trim($_POST['civilite']));
$_POST['nom'] = stripslashes(trim($_POST['nom']));
$_POST['prenom'] = stripslashes(trim($_POST['prenom']));
$_POST['adresse'] = stripslashes(trim($_POST['adresse']));
$_POST['cplad'] = stripslashes(trim($_POST['cplad']));
$_POST['etage'] = stripslashes(trim($_POST['etage']));
$_POST['porte'] = stripslashes(trim($_POST['porte']));
$_POST['ville'] = stripslashes(trim($_POST['ville']));
$_POST['codepostal'] = stripslashes(trim($_POST['codepostal']));
$_POST['mail'] = stripslashes(trim($_POST['mail']));
$_POST['phone'] = stripslashes(trim($_POST['phone']));
$_POST['password'] = stripslashes(trim($_POST['password']));
}
if(preg_match('#^(([a-z0-9!#$%&\'*+/=?^_`{|}~-]+.?)*[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)@(([a-z0-9-_]+.?)*[a-z0-9-_]+).[a-z]{2,4}$#i',$_POST['mail'])){
$id = '';
$civilite = $_POST['civilite'];
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$adresse = $_POST['adresse'];
$cplad = $_POST['cplad'];
$etage = $_POST['etage'];
$porte = $_POST['porte'];
$ville = $_POST['ville'];
$codepostal = $_POST['codepostal'];
$mail = $_POST['mail'];
$phone = $_POST['phone'];
$password = sha1($_POST['password']);
if($i = $bdd->prepare("
INSERT INTO client (id,civilite,nom,prenom,adresse,cplad,etage,porte,ville,codepostal,mail,phone,password)
VALUES (:id,:civilite,:nom,:prenom,:adresse,:cplad,:etage,:porte,:ville,:codepostal,:mail,:phone,:password)")
)
$i->bindParam(':id', $id);
$i->bindParam(':civilite', $civilite);
$i->bindParam(':nom', $nom);
$i->bindParam(':prenom', $prenom);
$i->bindParam(':adresse', $adresse);
$i->bindParam(':cplad', $cplad);
$i->bindParam(':etage', $etage);
$i->bindParam(':porte', $porte);
$i->bindParam(':ville', $ville);
$i->bindParam(':codepostal', $codepostal);
$i->bindParam(':mail', $mail);
$i->bindParam(':phone', $phone);
$i->bindParam(':password', $password);
$i->execute();
}else{
echo 'Veuillez entrer une adresse électronique valide';
}
}
?>
</body>
</html> |
Partager