public function verificationInscription() { //NOUVEL UTILISATEUR AVEC IP $cnx = parent::getCnx(); $user = new User($cnx, true, $_SERVER["REMOTE_ADDR"]); //INSCRIPTION DANS LA TABLE USER $user->ajouterUser(); //INSCRIPTION DANS LA TABLE MEMBRE $mail = $_POST['mail']; $mdp = $_POST['mdp1']; $id = $user->getId(); $ip = $user->getIp(); $nom = $_POST['nom']; $prenom = $_POST['prenom']; $adresse = $_POST['adresse']; $cp = $_POST['cp']; $ville = $_POST['ville']; $qualite = "FO"; //NOUVEAU MEMBRE $membre = new Membres($mail, $mdp, $id, $ip, $nom, $prenom, $adresse, $cp, $ville, $qualite); if ($membre->authentification($cnx) == FALSE) { if ($membre->ajouterMembre($cnx)) { return 1; } else { return -1; } } else { return 0; } }
public function verificationLogin() { $membres = new Membres($_POST['mail'], $_POST['mdp']); $resultat = $membres->authentification(parent::getCnx()); if ($resultat != false) { //SI LE MEMBRE AUTHENTIFIE EST UN ADMIN if ($resultat['QUALITE'] == 'BO') { //INSTANCIATION D'UN ADMINN UNIQUE $object_membre = new Admin($resultat['MAIL_USER'], $resultat['MDP_USER'], $resultat['ID_USER'], $resultat['IP'], $resultat['NOM_USER'], $resultat['PRENOM_USER'], $resultat['ADRESSE_USER'], $resultat['CP_USER'], $resultat['VILLE_USER'], $resultat['QUALITE']); } else { //INSTANCIATION D'UN MEMBRE $object_membre = new Membres($resultat['MAIL_USER'], $resultat['MDP_USER'], $resultat['ID_USER'], $resultat['IP'], $resultat['NOM_USER'], $resultat['PRENOM_USER'], $resultat['ADRESSE_USER'], $resultat['CP_USER'], $resultat['VILLE_USER'], $resultat['QUALITE']); } //SERIALISATION DE L'ADMIN OU DU MEMBRE $obj_serialise = serialize($object_membre); //ON STOCKE L'OBJET SERIALISE EN SESSION $_SESSION['membre'] = $obj_serialise; $_SESSION['idMembre'] = $resultat['ID_USER']; //Redirection vers la page Index header('Location: index.php?page=Default'); } }