IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

perte de session vraiment étrange


Sujet :

Langage PHP

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    188
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 188
    Points : 121
    Points
    121
    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

  2. #2
    Membre confirmé
    Inscrit en
    Février 2005
    Messages
    419
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Février 2005
    Messages : 419
    Points : 532
    Points
    532
    Par défaut
    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.

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    188
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 188
    Points : 121
    Points
    121
    Par défaut
    Le problème est que le register_globals est déjà à OFF

  4. #4
    Membre confirmé
    Inscrit en
    Février 2005
    Messages
    419
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Février 2005
    Messages : 419
    Points : 532
    Points
    532
    Par défaut
    Mmmm ... étrange.

    Donne voir ton code qu'on voit un peu ce qui se passe.

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    188
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 188
    Points : 121
    Points
    121
    Par défaut
    Voilà :

    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
    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>

  6. #6
    Membre confirmé
    Inscrit en
    Février 2005
    Messages
    419
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Février 2005
    Messages : 419
    Points : 532
    Points
    532
    Par défaut
    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.

  7. #7
    Membre régulier
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    188
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 188
    Points : 121
    Points
    121
    Par défaut
    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 ?

  8. #8
    Membre confirmé
    Inscrit en
    Février 2005
    Messages
    419
    Détails du profil
    Informations personnelles :
    Âge : 39

    Informations forums :
    Inscription : Février 2005
    Messages : 419
    Points : 532
    Points
    532
    Par défaut
    Sachant qu'on ne connait ni ta base de données ni tout ton code : non

Discussions similaires

  1. [JSP][session] perte de session et sendRedirect
    Par blaz dans le forum Servlets/JSP
    Réponses: 6
    Dernier message: 30/03/2007, 09h32
  2. Perte de Session d'une page à l'autre
    Par Flam dans le forum Langage
    Réponses: 3
    Dernier message: 15/03/2006, 14h34
  3. [Struts]Redirection globale en cas de perte de session
    Par Mercenary Developer dans le forum Struts 1
    Réponses: 10
    Dernier message: 03/02/2006, 14h40
  4. [navigateur]Problême de pertes de sessions sous IE (.js)
    Par Invité4 dans le forum Général JavaScript
    Réponses: 26
    Dernier message: 21/11/2005, 17h53
  5. [VB.NET] Perte de session entre 2 projets
    Par TekP@f dans le forum ASP.NET
    Réponses: 3
    Dernier message: 02/05/2005, 09h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo