Bonjour,

Plus mon projet grossi, moins le code devient lisible. Après certains avis, j'ai décidé de me mettre à la POO.
Je m'occupe dans un premier temps de l'inscription des membres, j'ai créer une page membre.class.php et inscription.php


class.Membre.php


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php 
 
class Membre{
	protected $pseudo;
	protected $motdepasse;
	protected $confirmationmotdepasse;
	protected $email;
	protected $confirmationemail;
	protected $jours;
	protected $mois;
	protected $annee;
	protected $datedenaissance;
	protected $sexe;
	protected $statut = 0;
	protected $codedeconfirmation;
	protected $captcha;
	protected $photo_profil = "default.png";
 
	function __construct ($_POST['sexe'], $_POST['jours'], $_POST['mois'], $_POST['annee'], $_POST['pseudo'], $_POST['mot_de_passe'], $_POST['confirmation_mot_de_passe'], $_POST['email'], $_POST['confirmation_email'], $_POST['captcha']){
		$this->sexe = secu_bdd($_POST['sexe']);
		$this->jours = secu_bdd($_POST['jours']);
		$this->mois = secu_bdd($_POST['mois']);
		$this->annee = secu_bdd($_POST['annee']);			
		$this->pseudo = secu_bdd($_POST['pseudo');
		$this->motdepasse = secu_bdd($_POST['mot_de_passe']);
		$this->confirmationmotdepasse = secu_bdd($_POST['confirmation_mot_de_passe']);
		$this->email = secu_bdd($_POST['email']);
		$this->confirmationemail = secu_bdd($_POST['confirmation_email']);
		$this->captcha = secu_bdd($_POST['captcha']);
	}
 
	public function membre_inscription(membre $pseudo, $motdepasse, $email, $datedenaissance, $sexe){
 
	}
}
 
?>
inscription.php

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php 
session_start();
$nom_page = "Inscription";
include_once("squelette/head.php"); 
include_once("script/bdd.php");
include_once("class/Membre.class.php");
require_once('script/js/xAjax/xajax_core/xajax.inc.php');
 
if(isset($_POST['submit'])){
	try{
	$membre = new Membre($_POST['sexe'], $_POST['jours'], $_POST['mois'], $_POST['annee'], $_POST['pseudo'], $_POST['mot_de_passe'], $_POST['confirmation_mot_de_passe'], $_POST['email'], $_POST['confirmation_email'], $_POST['captcha']);
	$membre->membre_inscription();
	}
	catch(Execption $bug){
		echo $bug->getMessage();
	}
 
}
?>
 
<div id="gauche">
<p>
	<form method="POST">
		<fieldset style="border-width:1px;">
 
			<legend class="sous_titre_orange">Informations personnelles : </legend>
 
			<label for="sexe">Je suis : </label>
			<input type="radio" name="sexe" value="homme" <?php echo (!empty($_POST['sexe']) AND ($_POST['sexe'] === "homme")) ? "chercked=checked" : "" ?>  /> un homme
			<input type="radio" name="sexe" value="femme" <?php echo (!empty($_POST['sexe']) AND ($_POST['sexe'] === "femme")) ? "chercked=checked" : "" ?> /> une femme 
			<br />
			<br />
 
			<label>Date de naissance :</label>
 
			<select name="jours">
				<?php echo (!empty($erreur) AND ($_POST['jours']  !== "0")) ? "<option value='".$_POST["jours"]."'>".$_POST["jours"]."</option>" : "<option value='0'>Jours</option>";
 
 
				for($jours = 0;$jours <= 31; $jours++){
					echo "<option value='".$jours."'>".$jours."</option>";				
				} ?>
 
			</select>
 
			/
 
			<select name="mois">
 
				<?php echo (!empty($erreur) AND ($_POST['mois']  !== "0")) ? "<option value='".$_POST["mois"]."'>".$_POST["mois"]."</option>" : "<option value='0'>Mois</option>";
 
 
				for($mois = 0; $mois <= 12; $mois++){
					echo "<option value='".$mois."'>".$mois."</option>";	
				} ?>
 
			</select>
 
			/
 
			<select name="annee">
 
				<?php echo (!empty($erreur) AND ($_POST['annee']  !== "0")) ? "<option value='".$_POST["annee"]."'>".$_POST["annee"]."</option>" : "<option value='0'>Année</option>";
 
 
				for($annee = 1930; $annee <= date('Y')-14; $annee++){
					echo "<option value='".$annee."'>".$annee."</option>";
				} ?>
 
			</select>
		</fieldset><br />
		<fieldset style="border-width:1px;">					
 
			<legend  class="sous_titre_orange">Informations du profil :</legend>					
 
			<label for="pseudo">Pseudo :</label> <input id="input"  type="text" name="pseudo" value="<?php if(!empty($erreur)){ echo $_POST['pseudo']; } ?>" /><br />
 
			<label for="mot_de_passe">Mot de passe :</label> <input id="input"  type="password" name="mot_de_passe" value="<?php if(!empty($erreur)){ echo $_POST['mot_de_passe']; } ?>" /><br />
 
			<label for="confirmation_mot_de_passe">Confirmation du mot de passe : </label><input id="input"  type="password" name="confirmation_mot_de_passe" value="<?php if(!empty($erreur)){ echo $_POST['confirmation_mot_de_passe']; } ?>" /><br />
 
			<label for="email">Adresse email :</label> <input id="input"  type="text" name="email" value="<?php if(!empty($erreur)){ echo $_POST['email']; } ?>" /><br />
 
			<label for="confirmation_email">Confirmation de l'adresse email : </label><input id="input"  type="text" name="confirmation_email" value="<?php if(!empty($erreur)){ echo $_POST['confirmation_email']; } ?>" /><br />
 
			<label for="captcha">Recopier le code : <img src="script/captcha.php" /> </label><input id="input"  type="text" name="captcha" />
		</fieldset><br />
		<input id="input"  type="submit" name="envoyer" value="Envoyer" />
 
	</form>
</p>	
</div>
 
<?php include_once("squelette/foot.php");
?>

Soyez, indulgent je débute à peine en POO.


J'ai remarqué que la function __construct masquait le formulaire. Comme si une erreur fatal mettait fin à l'exécution du code.
Je souhaite avoir des avis sur ce début de code, des conseils et surtout des réponses au sujet de ce problème.

Merci.