示例#1
0
            if (checkMailExist($email) or !filter_var($email, FILTER_VALIDATE_EMAIL)) {
                echo '<li>Email indisponible</li>';
                $erreurMail = true;
            }
            if (!samePasswords($motDePasse, $confirmation)) {
                echo '<li>Mot de passes ne correspondent pas</li>';
                $erreurMotDePasse = true;
            }
            ?>
                            </ul>
                        </div>
                        <?php 
            include __DIR__ . '/../vues/formulaireInscription.php';
        } else {
            // toutes les controles sont passees avec succes
            ajouterUser($pseudonyme, $nom, $prenom, $dateNaiss, $email, $motDePasse);
            ?>
                        <div class="alert alert-success alert-dismissable col-md-offset-2 col-md-8 text-center">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                            Votre inscription &agrave; &eacute;t&eacute; &eacute;ffectu&eacute;e avec suss&egrave;s.
                        </div>
                    <?php 
        }
    }
    ?>

            </div>
        </div>

    <?php 
} else {
示例#2
0
<?php

$nom = filter_input(INPUT_POST, 'nom', FILTER_SANITIZE_SPECIAL_CHARS);
$prenom = filter_input(INPUT_POST, 'prenom', FILTER_SANITIZE_SPECIAL_CHARS);
$email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_SPECIAL_CHARS);
$classe = filter_input(INPUT_POST, 'classe', FILTER_SANITIZE_SPECIAL_CHARS);
$dateNaissance = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_SPECIAL_CHARS);
$pseudo = filter_input(INPUT_POST, 'pseudo', FILTER_SANITIZE_SPECIAL_CHARS);
$password = filter_input(INPUT_POST, 'pass', FILTER_SANITIZE_SPECIAL_CHARS);
$description = filter_input(INPUT_POST, 'description', FILTER_SANITIZE_SPECIAL_CHARS);
$level = filter_input(INPUT_POST, 'userLevel', FILTER_SANITIZE_SPECIAL_CHARS);
if (isset($_REQUEST['envoyer'])) {
    ajouterUser($nom, $prenom, $email, $dateNaissance, $pseudo, $password, $description, $classe);
    redirect("index.php");
}
if (isset($_REQUEST['update'])) {
    $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_SPECIAL_CHARS);
    if ($level == "Utilisateur") {
        $level = 0;
    } else {
        $level = 1;
    }
    // Envoyer vers la fonction
    updateUser($nom, $prenom, $email, $dateNaissance, $pseudo, $password, $description, $id, $level);
    // On renvoie l'utilisateur sur la page d'affichage des utilisateurs
    redirect("utilisateurs.php");
}
if (isset($_REQUEST['deconnexion'])) {
    session_destroy();
    redirect("login.php");
}
 $user_mdp2 = $_POST["mdp2"];
 $user_mail = $_POST["mail"];
 if ($user_mdp != $user_mdp2) {
     echo '
                 <div class="alert alert-danger">
                   <strong>Fail!</strong> Les mots de passes doivent correspondre, Jean-Hubert.
                 </div>';
 } else {
     if (accountExists($idConnexion, $user_pseudo, $user_login, $user_mail)) {
         echo '
             <div class="alert alert-danger">
               <strong>Fail!</strong> T\'as déja un compte sur ce site, Jean-Philippe.
             </div>';
     } else {
         //$mov_image = $_FILES["image"]["name"];
         ajouterUser($idConnexion, $user_pseudo, $user_login, $user_mdp, $user_mail);
         echo ' 
             <div class="alert alert-success">
               <strong>Success!</strong> Votre compte a bien été créé.
             </div>';
     }
 }
 /* IMAGE POUR PLUS TARD
          }
        }
            
        } else {
            echo '
            <div class="alert alert-danger">
              <strong>Fail!</strong> Sorry, there was an error uploading your file.
            </div>';