Ce site est disponible à l'adresse suivante : https://serny-nsi.alwaysdata.net/
https://serny-nsi.alwaysdata.net/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
4.5 KiB
111 lines
4.5 KiB
<!-- 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>
|
|
</html>
|