Bonjour à tous,
Je créé actuellement un espace profil pour les membres connecté.
J'ai précédemment fait quelque modification pour l'accès à la page profil pour les membre, et bloqué pour ceux qui ne sont pas connecté.
Le problème c'est que les informations du membres ne s'affiche plus :/ je ne comprend pas pourquoi, aucune erreur ne s'affiche , voici mon code :

Code php : 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
<?php session_start(); ?>
<?php 
require_once("connexioninscription.inc.php");
$action = isset($_GET['action'])?htmlspecialchars($_GET['action']):'consulter';
$action = isset($_GET['action'])?htmlspecialchars($_GET['action']):'modifier';
$membre = isset($_GET['membre'])?(int) $_GET['membre']:'';
 
 
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="voir le profil." />
<meta name="keywords" content="profil" />
<title>voir le profil </title>
<link rel="shortcut icon" sizes="32x32" title="profil" type="image/png" href="mafavicon.png" />
<link href="css1.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="container">
<?php include("header.inc.php"); ?>
<?php include("menus.inc.php"); ?>
<div id="cadreprofil">
<?php
//On regarde la valeur de la variable $action
switch($action)
{
    //Si c'est "consulter"
    case "consulter":
       //On récupère les infos du membre
 
       $query = $bdd->prepare('SELECT membre_pseudo, membre_mail,  membre_inscription, membre_naissance, membre_msn, membre_yahoo, membre_facebook, membre_tumblr, membre_twitter, membre_flickr, membre_fotolog, membre_pinterest, membre_localisation, membre_profession, membre_avatar, membre_biographie, membre_signature, membre_nom, membre_prenom, membre_siteweb, membre_post FROM membres WHERE membre_id=:membre');
       $query->bindValue(':membre',$membre, PDO::PARAM_INT);
       $query->execute();
	   function dateUS2FR($date)
{
  $date = explode('-', $date);
  $date = array_reverse($date);
  $date = implode('/', $date);
  return $date;
}
       $data=$query->fetch(PDO::FETCH_ASSOC);
 
		echo'<h1 class="textesimple">Profil de '.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</h1>';
 
		echo '<div id="infosmembre">';
 
		echo '<p class="textesimple">'."Votre pseudo : ".stripslashes(htmlspecialchars($data['membre_pseudo'])).'</p>';
 
		echo'<img src="./images/avatars/'.$data['membre_avatar'].'"
       alt="Votre avatar" />';
 
		echo'<p class="textesimple">'."Votre adresse mail courante : ".'<a href="mailto:'.stripslashes($data['membre_mail']).'">'.stripslashes(htmlspecialchars($data['membre_mail'])).'</a></p>';
 
		echo'<p class="textesimple">'."Votre adresse Msn : ".'<a href="mailto:'.stripslashes($data['membre_msn']).'">'.stripslashes(htmlspecialchars($data['membre_msn'])).'</a></p>';
 
		echo'<p class="textesimple">'."Votre adresse Yahoo : ".'<a href="mailto:'.stripslashes($data['membre_yahoo']).'">'.stripslashes(htmlspecialchars($data['membre_yahoo'])).'</a></p>';
 
		echo '<p class="textesimple">'."Votre site web : ".'<a href="'.stripslashes($data['membre_siteweb']).'">'.stripslashes(htmlspecialchars($data['membre_siteweb'])).'</a></p>';
 
		echo'<p class="textesimple">'."Votre adresse Facebook : ".'<a href="'.stripslashes($data['membre_facebook']).'">'.stripslashes(htmlspecialchars($data['membre_facebook'])).'</a></p>';
 
		echo'<p class="textesimple">'."Votre adresse Tumblr : ".'<a href="'.stripslashes($data['membre_tumblr']).'">'.stripslashes(htmlspecialchars($data['membre_tumblr'])).'</a></p>';
 
		echo'<p class="textesimple">'."Votre adresse Twitter : ".'<a href="'.stripslashes($data['membre_twitter']).'">'.stripslashes(htmlspecialchars($data['membre_twitter'])).'</a></p>';
 
		echo'<p class="textesimple">'."Votre adresse Flickr : ".'<a href="'.stripslashes($data['membre_flickr']).'">'.stripslashes(htmlspecialchars($data['membre_flickr'])).'</a></p>';
 
		echo'<p class="textesimple">'."Votre adresse Fotolog : ".'<a href="'.stripslashes($data['membre_fotolog']).'">'.stripslashes(htmlspecialchars($data['membre_fotolog'])).'</a></p>';
 
		echo'<p class="textesimple">'."Votre adresse Pinterest : ".'<a href="'.stripslashes($data['membre_pinterest']).'">'.stripslashes(htmlspecialchars($data['membre_pinterest'])).'</a></p>';
 
 		echo '<p class="textesimple">'."Ce membre est inscrit depuis le ".dateUS2FR($data['membre_inscription']).'</p>';
 
		echo '<p class="textesimple">'."Vous avez posté : ".$data['membre_post']." message(s)".'</p>';
 
		echo '<p class="textesimple">'."Localisation : ".stripslashes(htmlspecialchars($data['membre_localisation'])).'</p>';
 
		echo '</div>';
 
       $query->CloseCursor();
 
       break;
 
    //Si on choisit de modifier son profil
    case "modifier":
    if (empty($_POST['sent'])) // Si on la variable est vide, on peut considérer qu'on est sur la page de formulaire
    {
        //On commence par s'assurer que le membre est connecté
 
		if ($id=(isset ($_SESSION['membre_id'])))
{
 
        //On prend les infos du membre
        $query=$bdd->prepare('SELECT membre_pseudo, membre_mail, membre_siteweb, membre_signature, membre_msn, membre_yahoo, membre_facebook, membre_tumblr, membre_twitter, membre_fotolog, membre_pinterest, membre_googleplus, membre_flickr, membre_nom, membre_prenom, membre_localisation, membre_profession, membre_biographie, membre_avatar FROM membres WHERE membre_id=:id');
        $query->bindValue(':id',$id,PDO::PARAM_INT);
        $query->execute();
        $data=$query->fetch();
        echo '<h1>Modifier son profil</h1>';
 
        echo '<form method="post" action="voirprofil.php?action=modifier" enctype="multipart/form-data">
        
  
        <fieldset><legend>Identifiants</legend>
        Pseudo : <strong>'.stripslashes(htmlspecialchars($data['membre_pseudo'])).'</strong><br />       
        <label for="password">Nouveau mot de Passe :</label>
        <input type="password" name="password" id="password" /><br />
        <label for="confirm">Confirmer le mot de passe :</label>
        <input type="password" name="confirm" id="confirm"  />
        </fieldset>
  
        <fieldset><legend>Contacts</legend>
        <label for="email">Votre adresse E_Mail :</label>
        <input type="text" name="email" id="email"
        value="'.stripslashes($data['membre_mail']).'" /><br />
  
        <label for="msn">Votre adresse MSN :</label>
        <input type="text" name="msn" id="msn"
        value="'.stripslashes($data['membre_msn']).'" /><br />
  
		<label for="yahoo">Votre adresse Yahoo :</label>
        <input type="text" name="yahoo" id="yahoo"
        value="'.stripslashes($data['membre_yahoo']).'" /><br />
		
		<label for="facebook">Votre adresse Facebook :</label>
        <input type="text" name="facebook" id="facebook"
        value="'.stripslashes($data['membre_facebook']).'" /><br />
		
		<label for="tumblr">Votre adresse Tumblr :</label>
        <input type="text" name="tumblr" id="tumblr"
        value="'.stripslashes($data['membre_tumblr']).'" /><br />
		
		<label for="twitter">Votre adresse Twitter :</label>
        <input type="text" name="twitter" id="twitter"
        value="'.stripslashes($data['membre_twitter']).'" /><br />
		
		<label for="pinterest">Votre adresse Pinterest :</label>
        <input type="text" name="pinterest" id="pinterest"
        value="'.stripslashes($data['membre_twitter']).'" /><br />
		
		<label for="fotolog">Votre adresse Fotolog :</label>
        <input type="text" name="fotolog" id="fotolog"
        value="'.stripslashes($data['membre_fotolog']).'" /><br />
		
		<label for="googleplus">Votre adresse Googleplus :</label>
        <input type="text" name="googleplus" id="googleplus"
        value="'.stripslashes($data['membre_googleplus']).'" /><br />
		
		<label for="flickr">Votre adresse Flickr :</label>
        <input type="text" name="flickr" id="flickr"
        value="'.stripslashes($data['membre_flickr']).'" /><br />
  
        <label for="website">Votre site web :</label>
        <input type="text" name="website" id="website"
        value="'.stripslashes($data['membre_siteweb']).'" /><br />
        </fieldset>
  
        <fieldset><legend>Informations supplémentaires</legend>
        <label for="localisation">Localisation :</label>
        <input type="text" name="localisation" id="localisation"
        value="'.stripslashes($data['membre_localisation']).'" /><br />
        </fieldset>
                
        <fieldset><legend>Profil sur le forum</legend>
        <label for="avatar">Changer votre avatar :</label>
        <input type="file" name="avatar" id="avatar" />
        (Taille max : 10 ko)<br /><br />
        <label><input type="checkbox" name="delete" value="Delete" />
        Supprimer l avatar</label>
        Avatar actuel :
        <img src="./images/avatars/'.$data['membre_avatar'].'"
        alt="pas d avatar" />
      
        <br /><br />
        <label for="signature">Signature :</label>
        <textarea cols="40" rows="4" name="signature" id="signature">
        '.stripslashes($data['membre_signature']).'</textarea>
		
		<br /><br />
        <label for="profession">Profession :</label>
        <textarea cols="40" rows="4" name="profession" id="profession">
        '.stripslashes($data['membre_profession']).'</textarea>
		
		<br /><br />
        <label for="biographie">Biographie :</label>
        <textarea cols="40" rows="4" name="biographie" id="biographie">
        '.stripslashes($data['membre_biographie']).'</textarea>
      
        </fieldset>
        <p>
        <input type="submit" value="Modifier son profil" />
        <input type="hidden" id="sent" name="sent" value="1" />
        </p></form>';
 
 
 
        $query->CloseCursor();   
				}
else
{
	echo '<p class="textewarning">'."Vous devez être connecté pour accèder à cette page.".'</p>';
	echo '<p class="textesimple">'."Inscrivez-vous : ".'<a href="inscription.php">'."Inscription ".'</a>'."ou connecté vous : ".'<a href="connexion.php">'."Connexion".'</a></p>';
}
    } 
 
    else //Cas du traitement
    {
     //On déclare les variables 
    $mdp_erreur = NULL;
    $email_erreur1 = NULL;
    $email_erreur2 = NULL;
    $msn_erreur = NULL;
    $signature_erreur = NULL;
    $avatar_erreur = NULL;
    $avatar_erreur1 = NULL;
    $avatar_erreur2 = NULL;
    $avatar_erreur3 = NULL;
 
    //Encore et toujours notre belle variable $i :p
    $i=0;
    $temps=time(); 
    $signature=$_POST['signature'];
    $email=$_POST['email'];
    $msn=$_POST['msn'];
	$yahoo=$_POST['yahoo'];
	$facebook=$_POST['facebook'];
	$tumblr=$_POST['tumblr'];
	$twitter=$_POST['twitter'];
	$pinterest=$_POST['pinterest'];
	$fotolog=$_POST['fotolog'];
	$googleplus=$_POST['googleplus'];
	$flickr=$_POST['flickr'];
    $website=$_POST['website'];
	$profession=$_POST['profession'];
	$biographie=$_POST['biographie'];
    $localisation=$_POST['localisation'];
    $pass=($_POST['password']);
    $confirm=($_POST['confirm']);
 
 
    //Vérification du mdp
    if ($pass != $confirm || empty($confirm) || empty($pass))
    {
         $mdp_erreur = "Votre mot de passe et votre confirmation diffèrent ou sont vides";
         $i++;
    }
 
    //Vérification de l'adresse email
    //Il faut que l'adresse email n'ait jamais été utilisée (sauf si elle n'a pas été modifiée)
 
    //On commence donc par récupérer le mail
    $query=$bdd->prepare('SELECT membre_mail FROM membres WHERE membre_id =:id'); 
    $query->bindValue(':id',$id,PDO::PARAM_INT);
    $query->execute();
    $data=$query->fetch();
    if (strtolower($data['membre_mail']) != strtolower($email))
    {
        //Il faut que l'adresse email n'ait jamais été utilisée
        $query=$bdd->prepare('SELECT COUNT(*) AS nbr FROM membres WHERE membre_mail =:mail');
        $query->bindValue(':mail',$email,PDO::PARAM_STR);
        $query->execute();
        $mail_free=($query->fetchColumn()==0)?1:0;
        $query->CloseCursor();
        if(!$mail_free)
        {
            $email_erreur1 = "Votre adresse email est déjà utilisé par un membre";
            $i++;
        }
 
        //On vérifie la forme maintenant
        if (!preg_match("#^[a-z0-9A-Z._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#", $email) || empty($email))
        {
            $email_erreur2 = "Votre nouvelle adresse E-Mail n'a pas un format valide";
            $i++;
        }
    }
    //Vérification de l'adresse MSN
    if (!preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#", $msn) && !empty($msn))
    {
        $msn_erreur = "Votre nouvelle adresse MSN n'a pas un format valide";
        $i++;
    }
 
    //Vérification de la signature
    if (strlen($signature) > 200)
    {
        $signature_erreur = "Votre nouvelle signature est trop longue";
        $i++;
    }
 
 
    //Vérification de l'avatar
 
    if (!empty($_FILES['avatar']['size']))
    {
        //On définit les variables :
        $maxsize = 30072; //Poid de l'image
        $maxwidth = 100; //Largeur de l'image
        $maxheight = 100; //Longueur de l'image
        //Liste des extensions valides
        $extensions_valides = array( 'jpg' , 'jpeg' , 'gif' , 'png', 'bmp' );
 
        if ($_FILES['avatar']['error'] > 0)
        {
        $avatar_erreur = "Erreur lors du tranfsert de l'avatar : ";
        }
        if ($_FILES['avatar']['size'] > $maxsize)
        {
        $i++;
        $avatar_erreur1 = "Le fichier est trop gros :
        (<strong>".$_FILES['avatar']['size']." Octets</strong>
        contre <strong>".$maxsize." Octets</strong>)";
        }
 
        $image_sizes = getimagesize($_FILES['avatar']['tmp_name']);
        if ($image_sizes[0] > $maxwidth OR $image_sizes[1] > $maxheight)
        {
        $i++;
        $avatar_erreur2 = "Image trop large ou trop longue :
        (<strong>".$image_sizes[0]."x".$image_sizes[1]."</strong> contre
        <strong>".$maxwidth."x".$maxheight."</strong>)";
        }
 
        $extension_upload = strtolower(substr(  strrchr($_FILES['avatar']['name'], '.')  ,1));
        if (!in_array($extension_upload,$extensions_valides) )
        {
                $i++;
                $avatar_erreur3 = "Extension de l'avatar incorrecte";
        }
    }
 
    }
    break;
 
default; //Si jamais c'est aucun de ceux-là c'est qu'il y a eu un problème :o
echo'<p>Cette action est impossible</p>';
 
 
 
    echo '<p><i>Vous êtes ici</i> : <a href="./index.php">Index du forum</a> --> Modification du profil';
    echo '<h1>Modification d\'un profil</h1>';
 
 
    if ($i == 0) // Si $i est vide, il n'y a pas d'erreur
    {
        if (!empty($_FILES['avatar']['size']))
        {
                $nomavatar=move_avatar($_FILES['avatar']);
                $query=$bdd->prepare('UPDATE membres SET membre_avatar = :avatar WHERE membre_id = :id');
                $query->bindValue(':avatar',$nomavatar,PDO::PARAM_STR);
                $query->bindValue(':id',$id,PDO::PARAM_INT);
                $query->execute();
                $query->CloseCursor();
        }
 
        //Une nouveauté ici : on peut choisis de supprimer l'avatar
        if (isset($_POST['delete']))
        {
                $query=$bdd->prepare('UPDATE membres SET membre_avatar=0 WHERE membre_id = :id');
                $query->bindValue(':id',$id,PDO::PARAM_INT);
                $query->execute();
                $query->CloseCursor();
        }
 
        echo'<h1>Modification terminée</h1>';
        echo'<p>Votre profil a été modifié avec succès !</p>';
        echo'<p>Cliquez <a href="./index.php">ici</a> 
        pour revenir à la page d accueil</p>';
 
        //On modifie la table
 
        $query=$bdd->prepare('UPDATE membres
        SET  membre_mdp = :mdp, membre_email=:mail, membre_msn=:msn,  membre_yahoo=:yahoo, membre_facebook=:facebook, membre_tumblr=:tumblr,  membre_twitter=:twitter, membre_pinterest=:pinterest, membre_fotolog=:fotolog, membre_googleplus=:googleplus, membre_flickr=:flickr, membre_siteweb=:website, membre_signature=:sign, membre_localisation=:loc, membre_profession=:profession, membre_biographie=:biographie, WHERE membre_id=:id');
        $query->bindValue(':mdp',$pass,PDO::PARAM_INT);
        $query->bindValue(':mail',$email,PDO::PARAM_STR);
        $query->bindValue(':msn',$msn,PDO::PARAM_STR);
		$query->bindValue(':yahoo',$yahoo,PDO::PARAM_STR);
		$query->bindValue(':facebook',$facebook,PDO::PARAM_STR);
		$query->bindValue(':tumblr',$tumblr,PDO::PARAM_STR);
		$query->bindValue(':twitter',$twitter,PDO::PARAM_STR);
		$query->bindValue(':fotolog',$fotolog,PDO::PARAM_STR);
		$query->bindValue(':pinterest',$pinterest,PDO::PARAM_STR);
		$query->bindValue(':googleplus',$googleplus,PDO::PARAM_STR);
		$query->bindValue(':flickr',$flickr,PDO::PARAM_STR);
        $query->bindValue(':website',$website,PDO::PARAM_STR);
        $query->bindValue(':sign',$signature,PDO::PARAM_STR);
        $query->bindValue(':loc',$localisation,PDO::PARAM_STR);
		$query->bindValue(':profession',$profession,PDO::PARAM_STR);
		$query->bindValue(':biographie',$biographie,PDO::PARAM_STR);
        $query->bindValue(':id',$id,PDO::PARAM_INT);
        $query->execute();
        $query->CloseCursor();
    }
    else
    {
        echo'<h1 class="texteerror">Modification interrompue</h1>';
        echo'<p class="texteerror">Une ou plusieurs erreurs se sont produites pendant la modification du profil</p>';
        echo'<p class="texteerror">'.$i.' erreur(s)</p>';
        echo'<p class="texteerror">'.$mdp_erreur.'</p>';
        echo'<p class="texteerror">'.$email_erreur1.'</p>';
        echo'<p class="texteerror">'.$email_erreur2.'</p>';
        echo'<p class="texteerror">'.$msn_erreur.'</p>';
        echo'<p class="texteerror">'.$signature_erreur.'</p>';
        echo'<p class="texteerror">'.$avatar_erreur.'</p>';
        echo'<p class="texteerror">'.$avatar_erreur1.'</p>';
        echo'<p class="texteerror">'.$avatar_erreur2.'</p>';
        echo'<p class="texteerror">'.$avatar_erreur3.'</p>';
        echo'<p class="textewarning"> Cliquez <a href="./voirprofil.php?action=modifier">ici</a> pour recommencer</p>';
}
    break;
 
default;//Si jamais c'est aucun de ceux là c'est qu'il y a eu un problème :o
echo'<p class="texteerror">Cette action est impossible</p>';
}//Fin du switch
?>
</div>
<?php include("footer.inc.php"); ?>
</div>
</body>
</html>

Merci pour votre aide et votre attention.