Précédent   Forum des professionnels en informatique > PHP > Langage > Sessions
Sessions Forum d'entraide sur les sessions avec PHP. Avant de poster -> FAQ sessions, Cours sessions et Sources sécurité
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 25/06/2008, 15h36   #1
Membre du Club
 
Inscription : novembre 2004
Messages : 147
Détails du profil
Informations forums :
Inscription : novembre 2004
Messages : 147
Points : 44
Points : 44
Par défaut perte de session vraiment étrange

Bonjour,
J'uilise des variables de session pour savoir si un utilisateur est identifié.
Sur toutes mes pages je n'ai aucun problème sauf une où je perds ma session de façon vraiment étrange.
Par exemple si je vais sur ma page avec un id passé en GET égale à 1 pas de problème. Mais si je passe un id égale à 3 là je perds ma session de manière inexplicable.
Avez vous déjà connu ce problème ?
Merci d'avance pour vos réponse
wehtam est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/06/2008, 15h43   #2
Membre éprouvé
 
Inscription : février 2005
Messages : 401
Détails du profil
Informations personnelles :
Âge : 27

Informations forums :
Inscription : février 2005
Messages : 401
Points : 450
Points : 450
Les écrasements de variables comme ça ça ressemble fort à un problème de l'option register_globals à on ça ...
Regarde ta configuration de PHP. Si c'est à on je te conseil très très fortement de passer à off.
Sylvain71 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/06/2008, 15h52   #3
Membre du Club
 
Inscription : novembre 2004
Messages : 147
Détails du profil
Informations forums :
Inscription : novembre 2004
Messages : 147
Points : 44
Points : 44
Le problème est que le register_globals est déjà à OFF
wehtam est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/06/2008, 15h53   #4
Membre éprouvé
 
Inscription : février 2005
Messages : 401
Détails du profil
Informations personnelles :
Âge : 27

Informations forums :
Inscription : février 2005
Messages : 401
Points : 450
Points : 450
Mmmm ... étrange.

Donne voir ton code qu'on voit un peu ce qui se passe.
Sylvain71 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/06/2008, 15h57   #5
Membre du Club
 
Inscription : novembre 2004
Messages : 147
Détails du profil
Informations forums :
Inscription : novembre 2004
Messages : 147
Points : 44
Points : 44
Voilà :

Code :
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
<?
session_start();
if($_SESSION["s_id_user"]=="")
{
?>
    <script language="javascript">
	parent.location.href="login.php?etat=out";
    </script>
<?
}
header('Content-type: text/html; charset=UTF-8'); 
require("fonction/fonction.inc.php");
$p=getProduit($_GET["id"]);
$options=listeOption();
$select=getOptionsProduit($_GET["id"]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="../resources/css/ext-all.css" />
<style>
.visible{ }
.masquer{display:none}
 
 
.Style1 {
	font-size: 12px;
	font-weight: bold;
}
</style>
<script type="text/javascript" src="../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../ext-all.js"></script>
<script type="text/javascript" src="../source/locale/ext-lang-fr.js"></script>
<script type="text/javascript" src="dataDelais.php?lng=<?=$_GET["lng"]?>"></script>
<script type="text/javascript" src="dataColoris.php?lng=<?=$_GET["lng"]?>"></script>
<script type="text/javascript" src="dataProduit.php?lng=<?=$_GET["lng"]?>"></script>
<script type="text/javascript" src="dataRubrique.php"></script>
    <script language="javascript">
 Ext.onReady(function(){
 
	 Ext.QuickTips.init();
    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'under';
	  var simple = new Ext.FormPanel({
        labelWidth: 100, // label settings here cascade unless overridden
        url:'save-form.php',
        frame:true,
		title: 'Modifier un produit à la catégorie : <? $temp=getRubriqueProduit($_GET["id_pere"]); echo addslashes($temp["LibelleRubrique"]);?>',
        bodyStyle:'padding:5px 5px 0',
        width: 900,
		fileUpload: true,
       // defaults: {width: 500},
        defaultType: 'textfield',
 
        items: [
				refproduit=  new Ext.form.TextField({
                fieldLabel: 'Référence',
				width : 250,
                name: 'refproduit',
				value:'<?=addslashes($p["RefProduit"])?>',
                allowBlank:false
            }),
			libelle=  new Ext.form.TextField({
                fieldLabel: 'Libellé',
				width : 250,
                name: 'libelle',
				value:'<?=addslashes(clean($p["LibelleProduit"]))?>',
                allowBlank:false
            }),
			description=  new Ext.form.TextArea({
                fieldLabel: 'Description',
				width : 572,
				height:180,
                name: 'description',
				value:'<?=addslashes(clean(str_replace(chr(13).chr(10),"",$p["Description"])))?>',
                allowBlank:false
            }),
			dimension=  new Ext.form.TextField({
                fieldLabel: 'Dimension',
				width : 250,
                name: 'dimension',
				value:'<?=addslashes($p["Dimensions"])?>',
                allowBlank:false
            }),
			prixHT=  new Ext.form.NumberField({
                fieldLabel: 'Prix HT',
				width : 250,
                name: 'prixHT',
				value:'<?=addslashes($p["PrixHT"])?>',
                allowBlank:false
            }),
			colori = new Ext.form.ComboBox({
                fieldLabel: 'Colori',
                store: new Ext.data.SimpleStore({
			fields: ['id', 'libelle'],
			data : Ext.dataColoris.Colori   // from states.js
		}),
		 displayField:'libelle',
		 valueField: 'id',
		 hiddenName: 'id_colori', 
            typeAhead: true,
            mode: 'local',
            triggerAction: 'all',
            emptyText:'Choisir un colori...',
            selectOnFocus:true,
			<? if($p["Coloris"]!=0){?>value :'<?=$p["Coloris"]?>',<?}?>
			forceSelection: true,
		width:300,
				allowBlank:false
            }),
			delai = new Ext.form.ComboBox({
                fieldLabel: 'Délai de livraison',
                store: new Ext.data.SimpleStore({
			fields: ['id', 'libelle'],
			data : Ext.dataDelais.Delai   // from states.js
		}),
		 displayField:'libelle',
		 valueField: 'id',
		 hiddenName: 'id_delai', 
            typeAhead: true,
            mode: 'local',
            triggerAction: 'all',
			<? if($p["DelaisLivraison"]!=0){?>value :'<?=$p["DelaisLivraison"]?>',<?}?>
            emptyText:'Choisir un délai de livraison...',
            selectOnFocus:true,
 
			forceSelection: true,
		width:300,
				allowBlank:false
            }),
			produit1 = new Ext.form.ComboBox({
                fieldLabel: 'Produit associé 1',
                store: new Ext.data.SimpleStore({
			fields: ['id', 'libelle'],
			data : Ext.dataProduits.Produit   // from states.js
		}),
		 displayField:'libelle',
		 valueField: 'id',
		 hiddenName: 'prod1', 
            typeAhead: true,
            mode: 'local',
			<? if($p["IdProduit1"]!=0){?>value :'<?=$p["IdProduit1"]?>',<?}?>
            triggerAction: 'all',
            emptyText:'Choisir un produit...',
            selectOnFocus:true,
 
			forceSelection: true,
		width:300
            }),
			produit2 = new Ext.form.ComboBox({
                fieldLabel: 'Produit associé 2',
                store: new Ext.data.SimpleStore({
			fields: ['id', 'libelle'],
			data : Ext.dataProduits.Produit   // from states.js
		}),
		 displayField:'libelle',
		 valueField: 'id',
		 hiddenName: 'prod2', 
		 <? if($p["IdProduit2"]!=0){?>value :'<?=$p["IdProduit2"]?>',<?}?>
            typeAhead: true,
            mode: 'local',
            triggerAction: 'all',
            emptyText:'Choisir un produit...',
            selectOnFocus:true,
 
			forceSelection: true,
		width:300
            }),
			produit3 = new Ext.form.ComboBox({
                fieldLabel: 'Produit associé 3',
                store: new Ext.data.SimpleStore({
			fields: ['id', 'libelle'],
			data : Ext.dataProduits.Produit   // from states.js
		}),
		 displayField:'libelle',
		 valueField: 'id',
		 hiddenName: 'prod3', 
            typeAhead: true,
			<? if($p["IdProduit3"]!=0){?>value :'<?=$p["IdProduit3"]?>',<?}?>
            mode: 'local',
            triggerAction: 'all',
            emptyText:'Choisir un produit...',
            selectOnFocus:true,
 
			forceSelection: true,
		width:300
            }),
			image=  new Ext.form.TextField({
                fieldLabel: 'Choisir une image (300x399) *.jpg<br><img src="../images/produits/mini/<?=$p["Imageproduit"]?>">',
                name: 'fichier',
				inputType: 'file'
            })<? if(is_array($options))
			{
				$i=0;
				foreach($options as $o)
				{
				?>
				,
			option<?=$i?> = new Ext.form.Checkbox({
                <? if($i==0){ ?>fieldLabel: 'Options', <? }else{ ?>labelSeparator:'',<? } ?>
                name: 'option[]',boxLabel :'<?=addslashes($o["LibelleFR"])?>',
				inputValue :'<?=$o["IdOption"]?>'
				<? if(is_array($select) && in_array($o["IdOption"],$select)){?>,checked:true<? } ?>
            })	
<? $i++;
				}
 
			}
			?>,
			enligne = new Ext.form.Checkbox({
                fieldLabel: 'En Ligne',
                name: 'enligne',
		<? if($p["EnLigne"]==1){?>checked:true,<?}?>
				inputValue :'1'
            })						
	        ],
	 buttons: [{
            text: 'Enregistrer le produit',
			handler: function() {
					simple.getForm().submit({url:'modif-produit.php?id=<?=$_GET["id"]?>' ,  waitMsg:'Enregistrement des informations ...',
			 success:function(form, action,response){ 
		   document.location.href='listeProduit.php?lng=<?=$_GET["lng"]?>&id_pere=<?=$_GET["id_pere"]?>';
	  }
 
                    });
					}
        },
		{
			text : 'Annuler',
			handler:function(){
			  document.location.href='listeProduit.php?lng=<?=$_GET["lng"]?>&id_pere=<?=$_GET["id_pere"]?>';
 
			}
		}]
    });
 
    simple.render('div_form');
 
 
	 var simple2 = new Ext.FormPanel({
        labelWidth: 100, // label settings here cascade unless overridden
        url:'save-form.php',
        frame:true,
		title: 'Changer de catégorie ',
        bodyStyle:'padding:5px 5px 0',
        width: 900,
		fileUpload: true,
       // defaults: {width: 500},
        defaultType: 'textfield',
 
        items: [
 
			rubrique = new Ext.form.ComboBox({
                fieldLabel: 'Catégorie',
                store: new Ext.data.SimpleStore({
			fields: ['id', 'libelle'],
			data : Ext.dataRubriques.Liste    // from states.js
		}),
		 displayField:'libelle',
		 valueField: 'id',
		 hiddenName: 'IdRubrique', 
            typeAhead: true,
            mode: 'local',
            triggerAction: 'all',
            emptyText:'Choisir un colori...',
            selectOnFocus:true,
			<? if($p["IdRubriqueProduit"]!=0){?>value :'<?=$p["IdRubriqueProduit"]?>',<?}?>
			forceSelection: true,
		width:650,
				allowBlank:false
            })					
	        ],
	 buttons: [{
            text: 'Changer de cat&eacute;gorie',
			handler: function() {
					simple2.getForm().submit({url:'modif-categorie-produit.php?id=<?=$_GET["id"]?>' ,  waitMsg:'Enregistrement des informations ...',
			 success:function(form, action,response){ 
		   document.location.href='listeProduit.php?lng=<?=$_GET["lng"]?>&id_pere='+rubrique.getValue();
	  }
 
                    });
					}
        }]
    });
 
    simple2.render('div_form2');
 
 
 })
 
 
 </script>
</head>
 
<body><br />
<br />
<table align="center"><tr><td>
<div id="div_form2" style="padding-top:5px">
</div>
<div id="div_form" style="padding-top:5px">
</div></td></tr></table>
 
</body>
</html>
wehtam est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 25/06/2008, 16h32   #6
Membre éprouvé
 
Inscription : février 2005
Messages : 401
Détails du profil
Informations personnelles :
Âge : 27

Informations forums :
Inscription : février 2005
Messages : 401
Points : 450
Points : 450
Je te conseille de faire un print_r($_GET) et print_r($_SESSION) au tout tout début de tes scripts (enfin après le session_start()) quand même, pour que tu vois dans les données brut si tu as vraiment ce que tu veux et si ça ne vient pas d'un de tes traitements après.
Sylvain71 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/06/2008, 09h14   #7
Membre du Club
 
Inscription : novembre 2004
Messages : 147
Détails du profil
Informations forums :
Inscription : novembre 2004
Messages : 147
Points : 44
Points : 44
Après quelques heures de recherche, je viens de trouver mais c'est tout à fait étrange.
En fait cela venait d'un enregistrement dans ma base de données, j'ai supprimé cet enregistrement et là par miracle je ne perds plus du tout ma session.
Je n'avais jamais vu ça avant, vraiment vraiment étrange.
Avez vous une explication ?
wehtam est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 26/06/2008, 09h16   #8
Membre éprouvé
 
Inscription : février 2005
Messages : 401
Détails du profil
Informations personnelles :
Âge : 27

Informations forums :
Inscription : février 2005
Messages : 401
Points : 450
Points : 450
Sachant qu'on ne connait ni ta base de données ni tout ton code : non
Sylvain71 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 18h18.


 
 
 
 
Partenaires

Hébergement Web