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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
<?php
$bdd = new PDO('mysql:host=127.0.0.1;dbname=palm', 'root', '');
if (isset($_POST['envoyer']))
{
$Nomdutilisateur = htmlspecialchars($_POST['Nomdutilisateur']);
$Motdepasse = sha1($_POST['Motdepasse']);
$Motdepasse2 = sha1($_POST['Motdepasse2']);
$Nom = htmlspecialchars($_POST['Nom']);
$Prenom = htmlspecialchars($_POST['Prenom']);
$email = htmlspecialchars($_POST['email']);
if (!empty($_POST['Nomdutilisateur']) AND !empty($_POST['Motdepasse']) AND !empty($_POST['Motdepasse2']) AND !empty($_POST['Nom']) AND !empty($_POST['Prenom']) AND !empty($_POST['email']))
{
$Nomdutilisateur = htmlspecialchars($_POST['Nomdutilisateur']);
$Motdepasse = sha1($_POST['Motdepasse']);
$Motdepasse2 = sha1($_POST['Motdepasse2']);
$Nom = htmlspecialchars($_POST['Nom']);
$Prenom = htmlspecialchars($_POST['Prenom']);
$email = htmlspecialchars($_POST['email']);
$Nomdutilisateurlength = strlen($Nomdutilisateur);
if ($Nomdutilisateurlength <= 255)
{
if (filter_var($email, FILTER_VALIDATE_EMAIL))
{
$reqmail = $bdd->prepare('SELECT * FROM membres WHERE mail = ?');
$reqmail->execute(array($email));
$mailexist = $reqmail->rowCount();
if ($mailexist == 0)
{
if ($Motdepasse == $Motdepasse2)
{
$insertmbr = $bdd->prepare("INSERT INTO membres (Nom d'Utilisateur, Mot de passe, Nom, Prenom, email) value(?, ?, ?, ?, ?) ");
$insertmbr->execute(array($Nomdutilisateur, $Motdepasse, $Nom, $Prenom, $email));
$erreur = "Votre compte a bien été crée !";
}
else
{
$erreur = "Vos mots de passes ne correspondent pas !";
}
}
else
{
$erreur = "Adresse mail déjà utilisée !";
}
}
else
{
$erreur = "Votre adresse email n'est la valide !";
}
}
else
{
$erreur = "Votre Nomdutilisateur ne doit pas depassé 255 caractères !";
}
}
else
{
$erreur = " Tous les champs doivent etre completés !";
}
}
?>
<html>
<head>
<title>Palmci > Inscription </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="img/logo.png">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/all.min.css">
<link rel="stylesheet" type="text/css" href="login.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="accueil" id="accueil" >
<div class="contain-wrapper">
<div class="container" align="center">
<div class="row login" >
<div class="col-md-4 col-sm-12 col-xs-12 form" style="margin-top: -5px; margin-left: 33%"
>
<!-- Bloc Logo -->
<form style="width: 200px; height: 120px; padding: 10px 15px 10PX 15px ">
<img src="img/logo.png" style="width: 170px; height: 100px">
</form>
<!-- -->
<!-- Bloc Connexion -->
<form method="POST" action="" >
<h3 class="text-center" align="center" style="color: #fff; margin-top:3px"> Inscrivez-vous </h3>
<div class="accountinp" >
<div class="input-group input-group-lg" >
<span class="input-group-addon" id="basic-addon1">
<i class="fas fa-user"></i>
</span>
<input type="text" class="form-control" placeholder="Nom d'utilisateur " name="Nomdutilisateur" style="width: 276px" value= "<?php if(isset($Nomdutilisateur)) { echo $Nomdutilisateur;} ?>" >
</div><br>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="basic-addon1">
<i class="fas fa-lock"></i>
</span>
<input type="password" class="form-control" placeholder="Mot de passe" name="Motdepasse" style="width:276px" >
</div> <br>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="basic-addon1">
<i class="fas fa-lock"></i>
</span>
<input type="password" class="form-control" placeholder="Confirmer Mot de Passe" name="Motdepasse2" style="width: 276px">
</div> <br>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="basic-addon1">
<i class="fas fa-user-ninja"></i>
</span>
<input type="text" class="form-control" placeholder="Nom" name="Nom" style="width: 276px" value= "<?php if(isset($Nom)) { echo $Nom;} ?>" >
</div><br>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="basic-addon1">
<i class="fas fa-user-ninja"></i>
</span>
<input type="text" class="form-control" placeholder="Prenom" name="Prenom" style="width: 276px" value= "<?php if(isset($Prenom)) { echo $Prenom;} ?>" >
</div><br>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="basic-addon1">
<i class="fas fa-envelope"></i>
</span>
<input type="Email" class="form-control" placeholder="Email" name="email" style="width: 276px" value= "<?php if(isset($email)) { echo $email;} ?>" >
</div>
</div><br>
<button class="btn btn-block" type="submit" name="envoyer" style="width: 10em; ">Je m'inscris</button>
</form>
<!-- -->
</div>
</div>
<?php
if (isset($erreur))
{
echo '<font color="white">' .$erreur. '</font>';
}
?>
</div>
</div>
</div>
</body>
</html> |
Partager