Je pars donc d'une feuille blanche pour créer un espace membre (et bien encore plus par la suite;) )
J'ai essayé de trouver des infos et surtout de créer un code simple et basique.
Voilà mon code php de la page d'inscription.
<? php
require('src/connection.php');
if(!empty($_POST['pseudo']) && !empty($_POST['email']) && !empty($_POST['password']) && !empty($_POST['password_confirm'])){
//VARIABLES
$pseudo = $_POST['pseudo'];
$email = $_POST['email'];
$password = $_POST['password'];
$password_confirm = $_POST['password_confirm'];
//TEST SI PASSWORD = PASSWORD_CONFIRM
if($password != $password_confirm){
header('location: ../?error=1&pass=1');
}
//TEST SI MAIL UTILISE
$req = $db->prepare("SELECT COUNT(*) AS numberEmail FROM users WHERE email = ?");
$req->execute(array($email));
while($email_verification = $req->fetch()){
if($email_verification['numberemail'] !=0){
header('location: ../?error=1&email=1');
}
}
//HASH
$secret = sha1($email).time();
$secret = sha1($secret).time().time();
//CRYPTAGE DU PASSWORD
$password = "aq1".sha1($password."1254")."25";
//ENVOI DE LA REQUETE
$req = $db->prepare("INSERT INTO user(pseudo, email, passworrd, secret) VALUES(?, ?, ?, ?)");
$req->execute(array($pseudo, $email, $password, $secret));
header('location: ../?succes=1');
}
?>
Sur le haut de ma page s'affiche ceci
prepare("SELECT COUNT(*) AS numberEmail FROM users WHERE email = ?"); $req->execute(array($email)); while($email_verification = $req->fetch()){ if($email_verification['numberemail'] !=0){ header('location: ../?error=1&email=1'); } } //HASH $secret = sha1($email).time(); $secret = sha1($secret).time().time(); //CRYPTAGE DU PASSWORD $password = "aq1".sha1($password."1254")."25"; //ENVOI DE LA REQUETE $req = $db->prepare("INSERT INTO user(pseudo, email, passworrd, secret) VALUES(?, ?, ?, ?)"); $req->execute(array($pseudo, $email, $password, $secret)); header('location: ../?succes=1'); } ?>
Quelle est mon erreur SVP, je ne comprends pas mon problème.
Merci d'avance pour votre aide.