@ -1,5 +1,3 @@
< < < < < < < HEAD
< < < < < < < HEAD
<!-- Traitement PHP -->
<!-- Traitement PHP -->
<?php
<?php
/*
/*
@ -110,229 +108,4 @@ if (isset($_POST['submit'])) {
< / form >
< / form >
< / div >
< / div >
< / body >
< / body >
=======
<!-- Traitement PHP -->
<?php
/*
Faire de la sécurité et de l'optimisation
Ce code est pourri
*/
$servername = 'mysql-serny-nsi.alwaysdata.net';
$username = 'serny-nsi';
$mdp = 'ecole9090*';
$bdd = new PDO('mysql:host=mysql-serny-nsi.alwaysdata.net;dbname=serny-nsi_main', $username, $mdp);
if (isset($_POST['submit'])) {
if (isset($_POST["f_email"]) AND !empty($_POST["f_email"]) AND isset($_POST["f_pseudo"]) AND !empty($_POST["f_pseudo"])AND isset($_POST["f_password"]) AND !empty($_POST["f_password"]) AND isset($_POST['f_password2']) AND !empty($_POST['f_password2'])) {
if ($_POST['f_password'] == $_POST['f_password2']) {
$password = password_hash(htmlspecialchars($_POST['f_password']), PASSWORD_DEFAULT);
$pseudo = htmlspecialchars($_POST['f_pseudo']);
$mail = htmlspecialchars($_POST['f_email']);
$mail2 = htmlspecialchars($_POST['f_email2']);
if($mail == $mail2) {
if (strlen($pseudo) < 254 ) {
if (strlen($mail) < 254 ) {
$look = $bdd->prepare("SELECT * FROM membres WHERE pseudo = ?");
$look->execute(array($pseudo));
$alreadyexist = -1;
$alreadyexist = $look->rowCount();
$lookmail = $bdd->prepare("SELECT * FROM membres WHERE mail = ?");
$lookmail->execute(array($mail));
$alreadyexist2 = -1;
$alreadyexist2 = $lookmail->rowCount();
if ($alreadyexist == 0 AND $alreadyexist2 == 0) {
$ins = $bdd->prepare("INSERT INTO membres(pseudo, mail, password, signup_date) VALUES(?, ?, ?, now())");
$ins->execute(array($pseudo, $mail, $password));
$erreur ="Vous avez été correctement inscrit dans notre base de donnée.";
} else {
$erreur ="Ce pseudo/mail est déjà utilisé";
}
} else {
$erreur ="Le mail est trop long (max 255c)";
}
} else {
$erreur ="Le pseudo est trop long (max 255c)";
}
} else {
$erreur = "Les mails sont différents.";
}
} else {
$erreur = "Les mots de passe sont différents.";
}
} else {
$erreur = "Veuillez remplir les champs ci-dessus.";
}
}
?>
<!DOCTYPE html>
< html lang = "fr" >
< head >
< title > Conenxion< / title >
< meta charset = "UTF-8" >
< link href = "style/style_log.css" rel = "stylesheet" >
< link rel = "icon" type = "image/x-icon" href = "_content/favicon-32x32.png" >
< / head >
< body >
< div class = "log-area" >
< p > Inscris-toi pour accéder à plus de foncitonnalités< / p >
< form action = "" method = "POST" >
< div class = "f_inputs" >
< div >
< label for = "f_pseudo" > Pseudo : < / label > < input type = "text" id = "f_pseudo" maxlength = "70"
placeholder="Pseudo" name="f_pseudo" autocomplete="off">
< / div >
< div >
< label for = "f_email" > Adresse mail : < / label > < input type = "email" id = "f_email" maxlength = "70"
placeholder="Adresse mail" name="f_email" autocomplete="off">
< / div >
< div >
< label for = "f_email2" > Confirmer : < / label > < input type = "email" id = "f_email2" maxlength = "70"
placeholder="Confirmer"
name="f_email2" autocomplete="off">
< / div >
< div >
< label for = "f_password" > Mot de passe : < / label > < input type = "password" id = "f_password" maxlength = "40"
placeholder="Mot de passe"
name="f_password" autocomplete="off">
< / div >
< div >
< label for = "f_password2" > Confirmer : < / label > < input type = "password" id = "f_password2"
maxlength="40" placeholder="Confirmer"
name="f_password2" autocomplete="off">
< / div >
< / div >
< div class = "buttons" >
< div class = "sign_up" >
< a href = "sign_in.php" > Déjà un compte ?< / a >
< / div >
< div class = "sign_in" >
< input type = "submit" name = "submit" value = "S'inscrire" id = "submit" >
< / div >
< / div >
< p >
<? = $erreur ?>
< / p >
< / form >
< / div >
< / body >
>>>>>>> d120872e658c0bb2df803f19a903096b4a6a7928
=======
<!-- Traitement PHP -->
<?php
/*
Faire de la sécurité et de l'optimisation
Ce code est pourri
*/
$servername = 'mysql-serny-nsi.alwaysdata.net';
$username = 'serny-nsi';
$mdp = 'ecole9090*';
$bdd = new PDO('mysql:host=mysql-serny-nsi.alwaysdata.net;dbname=serny-nsi_main', $username, $mdp);
if (isset($_POST['submit'])) {
if (isset($_POST["f_email"]) AND !empty($_POST["f_email"]) AND isset($_POST["f_pseudo"]) AND !empty($_POST["f_pseudo"])AND isset($_POST["f_password"]) AND !empty($_POST["f_password"]) AND isset($_POST['f_password2']) AND !empty($_POST['f_password2'])) {
if ($_POST['f_password'] == $_POST['f_password2']) {
$password = password_hash(htmlspecialchars($_POST['password']), PASSWORD_BCRYPT);
$pseudo = htmlspecialchars($_POST['f_pseudo']);
$mail = htmlspecialchars($_POST['f_email']);
$mail2 = htmlspecialchars($_POST['f_email2']);
if($mail == $mail2) {
if (strlen($pseudo) < 254 ) {
if (strlen($mail) < 254 ) {
$look = $bdd->prepare("SELECT * FROM membres WHERE pseudo = ?");
$look->execute(array($pseudo));
$alreadyexist = -1;
$alreadyexist = $look->rowCount();
$lookmail = $bdd->prepare("SELECT * FROM membres WHERE mail = ?");
$lookmail->execute(array($mail));
$alreadyexist2 = -1;
$alreadyexist2 = $lookmail->rowCount();
if ($alreadyexist == 0 AND $alreadyexist2 == 0) {
$ins = $bdd->prepare("INSERT INTO membres(pseudo, mail, password, signup_date) VALUES(?, ?, ?, now())");
$ins->execute(array($pseudo, $mail, $password));
$erreur ="Vous avez été correctement inscrit dans notre base de donnée.";
} else {
$erreur ="Ce pseudo/mail est déjà utilisé";
}
} else {
$erreur ="Le mail est trop long (max 255c)";
}
} else {
$erreur ="Le pseudo est trop long (max 255c)";
}
} else {
$erreur = "Les mails sont différents.";
}
} else {
$erreur = "Les mots de passe sont différents.";
}
}
}
?>
<!DOCTYPE html>
< html lang = "fr" >
< head >
< title > Conenxion< / title >
< meta charset = "UTF-8" >
< link href = "style/style_log.css" rel = "stylesheet" >
< link rel = "icon" type = "image/x-icon" href = "_content/favicon-32x32.png" >
< / head >
< body >
< div class = "log-area" >
< p > Inscris-toi pour accéder à plus de foncitonnalités< / p >
< form action = "" method = "POST" >
< div class = "f_inputs" >
< div >
< label for = "f_pseudo" > Pseudo : < / label > < input type = "text" id = "f_pseudo" maxlength = "70"
placeholder="Pseudo" name="f_pseudo" autocomplete="off">
< / div >
< div >
< label for = "f_email" > Adresse mail : < / label > < input type = "email" id = "f_email" maxlength = "70"
placeholder="Adresse mail" name="f_email" autocomplete="off">
< / div >
< div >
< label for = "f_email2" > Confirmer : < / label > < input type = "email" id = "f_email2" maxlength = "70"
placeholder="Confirmer"
name="f_email2" autocomplete="off">
< / div >
< div >
< label for = "f_password" > Mot de passe : < / label > < input type = "password" id = "f_password" maxlength = "40"
placeholder="Mot de passe"
name="f_password" autocomplete="off">
< / div >
< div >
< label for = "f_password2" > Confirmer : < / label > < input type = "password" id = "f_password2"
maxlength="40" placeholder="Confirmer"
name="f_password2" autocomplete="off">
< / div >
< / div >
< div class = "buttons" >
< div class = "sign_up" >
< a href = "sign_in.html" > Déjà un compte ?< / a >
< / div >
< div class = "sign_in" >
< input type = "submit" name = "submit" value = "S'inscrire" id = "submit" >
< / div >
< / div >
< div >
<? = $erreur ?>
< / div >
< / form >
< / div >
< / body >
>>>>>>> 24db56327fed9097898d28c291f7d01a5d9802b1
< / html >
< / html >