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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
| if(isset($_POST['NOMDEB']))
{
$NOMDEB= $_POST['NOMDEB'];}
if(isset($_POST['PRENDEB']))
{
$PRENDEB = $_POST['PRENDEB'];}
if(isset($_POST['ADRDEB']))
{
$ADRDEB = $_POST['ADRDEB'];}
if(isset($_POST['VILLEDEB']))
{
$VILLEDEB = $_POST['VILLEDEB'];}
if(isset($_POST['CPDEB']))
{
$CPDEB = $_POST['CPDEB'];}
if(isset($_POST['PAYSDEB']))
{
$PAYSDEB = $_POST['PAYSDEB'];}
if(isset ($_POST['submit']))
{
$connexion = new PDO('mysql:host=localhost;dbname=test', 'root', '') ; // connexion à la base de données
$req1=$connexion->exec("INSERT INTO client VALUES ('','$NOMDEB','$PRENDEB','$ADRDEB','$CPDEB','$VILLEDEB')");
}
if(isset($_POST['IBCLT']))
{
$IBCLT = $_POST['IBCLT'];
}
if(isset($_POST['BICLT']))
{
$BICLT = $_POST['BICLT'];
}
if(isset ($_POST['submit']))
{
// tester la longueur de l'Iban et le Bic
if (strlen($IBCLT) != 27) {exit("Longueur de l'Ib invalide.");
}else
if (strlen($BICLT) != 11) {exit("Longueur du Bi invalide.");
}
$connexion = new PDO('mysql:host=localhost;dbname=test', 'root', '') ; // connexion à la base de données
$req1=$connexion->exec("INSERT INTO compte VALUES ('','$IBCLT','$BICLT')");//select
//requête mysql
$MAILDEB=htmlentities(trim($_POST['MAILDEB']));
$PSWDEB=htmlentities(trim($_POST['PSWDEB']));
$repeatpassword=htmlentities(trim($_POST['repeatpassword']));
//vérifier si les deux mot de passe sont identiques
if($MAILDEB&&$PSWDEB&&$repeatpassword&&$NOMDEB&&$PRENDEB&&$ADRDEB&&$CPDEB&&$VILLEDEB&&$IBCLT&&$BICLT)
{
if ($PSWDEB==$repeatpassword)
{
$PSWDEB=sha1($PSWDEB);
$connexion = new PDO('mysql:host=localhost;dbname=test', 'root', '') ; // connexion à la base de données
$req1 = $connexion->prepare('SELECT MAILDEB FROM client');
$req1->execute();
if (isset($_POST['MAILDEB']))
{
$MAILDEB = htmlentities($_POST['MAILDEB']);
// On insère la variable LOGINDEB qui correspond à la saisie de l'utilisateur dans la requête SQL
$req1 = $connexion->prepare('SELECT MAILDEB FROM client WHERE MAILDEB = \''.$MAILDEB.'\';');
$req1->execute(array('.$MAILDEB.' => $_POST['MAILDEB']));
// recherche de résultat
$res = $req1->fetch();
if ($res)
{
echo "Cet E-mail existe déjà !";
}
else
{
echo "Bienvenue !" ;
$req1=$connexion->exec("INSERT INTO dclient VALUES('','$MAILDEB','$PSWDEB')");
/* Test de vérification pour savoir si la requête s'execute bien
$connexion->exec($req1);*/
die (" Inscription terminee <a href='accueil.php'> Connectez </a>vous ici");
}
}else echo "<center>Les deux mot de passe doivent être identiques</center>";
}
}else echo"<center>Veuillez saisir tous les champs</center>";
}
?> |
Partager