Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['identifiant'])) $identifiant=$_POST['identifiant'];
- else $identifiant="";
- if(isset($_POST['mdp'])) $mdp=$_POST['mdp'];
- else $mdp="";
- if(isset($_POST['prenom'])) $prenom=$_POST['prenom'];
- else $prenom="";
- if(isset($_POST['nom'])) $nom=$_POST['nom'];
- else $nom="";
- if(isset($_POST['mail'])) $mail=$_POST['mail'];
- else $mail="";
- if(isset($_POST['ecole'])) $ecole=$_POST['ecole'];
- else $ecole="";
- if(empty($identifiant) OR empty($mdp) OR empty($prenom) OR empty($nom) OR empty($mail) OR empty($ecole))
- {
- echo '<font color="red">Attention, merci de remplir les champs !</font>';
- }
- else
- {
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "evenement";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Erreur de connexion: " . $conn->connect_error);
- }
- // duplicate check
- $check_mail = "SELECT mail FROM utilisateur WHERE mail='".$mail."'";
- $resultat = mysql_query($check_mail);
- $nombre_mail = mysql_num_rows($resultat);
- if($nombre_mail < 1) {
- header('Location: ../erreurinscription.php');
- }
- $sql = "INSERT INTO utilisateur(identifiant, mdp, prenom, nom, mail, ecole) VALUES('$identifiant','$mdp','$prenom','$nom','$mail','$ecole')";
- if($conn->query($sql) === true){
- header('Location: ../succesinscription.php');
- }else{
- header('Location: ../erreurinscription.php');
- }
- $conn->close();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement