Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include'db/connexiondb.php';
- if(isset($_POST['valider']) AND $_POST['valider']) {
- $nom = $_POST['nom'];
- $prenom = $_POST['prenom'];
- $email = $_POST['email'];
- $mdp = sha1($_POST['mdp']);
- $id_destinataire = $bdd->prepare('SELECT email FROM images WHERE email = ?');
- $id_destinataire->execute(array($email));
- $dest_exist = $id_destinataire->rowCount();
- if($dest_exist == 0) {
- if(filter_var($email, FILTER_VALIDATE_EMAIL)) {
- $req = $bdd->prepare("INSERT INTO images (nom, prenom, email, mdp) VALUES (?,?,?,?)");
- $req->execute(array($nom, $prenom, $email, $mdp));
- } else {
- echo "Extension Adresse Mail mauvaise";
- }
- } else {
- echo "E-Mail déja Utilisé";
- }
- }
- if(isset($_POST['co']) AND $_POST['co']) {
- $requser = $bdd->prepare("SELECT * FROM images WHERE id = ?");
- $requser->execute(array($_SESSION['id']));
- $user = $requser->fetch();
- $emailco = $_POST['emailco'];
- $mdpco = sha1($_POST['mdpco']);
- $requser = $bdd->prepare("SELECT * FROM images WHERE email = ? AND mdp = ?");
- $requser->execute(array($emailco, $mdpco));
- $userexist = $requser->rowCount();
- if($userexist == 1) {
- echo "c bon";
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <div align="left">
- <form method="POST">
- <input type="text" placeholder="Nom" name="nom">
- <br/>
- <input type="text" placeholder="Prénom" name="prenom">
- <br/>
- <input type="text" placeholder="E-Mail" name="email">
- <br/>
- <input type="password" placeholder="Mot De Passe" name="mdp">
- <br/>
- <input type="submit" value="Inscription" name="valider">
- </form>
- </div>
- <div align="center">
- <form method="POST">
- <input type="email" name="emailco">
- <br/>
- <input type="password" name="mdpco">
- <br/>
- <input type="submit" value="Connexion" name="co">
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement