public function update(PersonneDB $personneDB)
 {
     $q = $this->_db->prepare('UPDATE personnes SET nom = ":nom", prenom = ":prenom", rue = ":rue", numero = :numero, telephone = ":telephone", idville = :idville WHERE id = :id');
     $q->bindValue(':id', $personneDB->getId());
     $q->bindValue(':nom', $personneDB->getNom());
     $q->bindValue(':prenom', $personneDB->getPrenom());
     $q->bindValue(':rue', $personneDB->getRue());
     $q->bindValue(':numero', $personneDB->getNumero());
     $q->bindValue(':telephone', $personneDB->getTelephone());
     $q->bindValue(':idville', $personneDB->getIdville());
 }
예제 #2
0
        <div class="container col-xs-offset-2 col-xs-8">
            <form class="form-signin" method="post">
                <h2 class="form-signin-heading">S'inscrire</h2>
                <p><input class="form-control" placeholder="Identifiant" name="identifiant" required autofocus></p>
                <p><input type="password" class="form-control" placeholder="Mot de Passe" name="motdepasse" required></p>
                <p><input type="password" class="form-control" placeholder="Retapez le mot de passe" name="vmotdepasse" required></p>
                <p><input class="btn btn-lg btn-primary btn-block" type="submit"></p>
            </form>
        </div>

    </div>

</div>

<?php 
if (!empty($_POST)) {
    $nouvelUtilisateur = new PersonneDB();
    $personneManager = new PersonneManager($_SESSION['connexion']);
    if (empty($personneManager->verificationIdentifiant($_POST['identifiant']))) {
        if ($_POST['motdepasse'] == $_POST['vmotdepasse']) {
            $nouvelUtilisateur->setIdentifiant($_POST['identifiant']);
            $nouvelUtilisateur->setMotdepasse(sha1($_POST['motdepasse']));
            $personneManager->add($nouvelUtilisateur);
            print "valider";
        } else {
            print "les mots de passes ne sont pas identiques";
        }
    } else {
        print "identifiant déjà inscrit";
    }
}