Si vous avez déjà eu à faire à ce cas de figure, où vous devez définir une variable de session juste avant un appel à la fonction header() pour changer de page (header('Location: ...');), alors vous avez sans doute remarqué qu'une fois arrivé sur la page, vous n'avez plus aucune trace de votre variable de session !
Pour palier à ce petit problème, il suffit de rajouter à votre URL l'id de la session grâce à la constante SID, comme suit :
<?php $_SESSION['foo'] = 'bar'; header('Location: mypage.php'.SID);
Commentaires :
# X4D34th, le jeudi 7 avril 2011 à 17:15:59 # delphiki, le jeudi 7 avril 2011 à 17:51:24Exact, mais le mieux reste quand même de rester indépendant au maximum de la configuration serveur :)
Tiens, deux semaines plutôt ça aurait été génial cette petite astuce. Ici, j'ai du m'en passer en trouvant un système alternatif ;)
Merco ;)
Je t'en prie :)
Désolé d'arriver trop tard ^^
Félicitations et merci pour ton travail
Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it
Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it
very interesting , good job and thanks for sharing such a good blog.
Interesting stuff to read. Keep it up.
this is very informative and intersting for those who are interested in blogging field.
thanks really effective list to boost up ranking in search engine.
very interesting , good job and thanks for sharing such a good blog
this is very informative and interesting for those who are interested in blogging field
I am really happy to say it’s an interesting post to read . I learn new information from your article , you are doing a great job . Keep it up
Another great PHP tutorial from you, thanks a lot!
I am so happy to find this amazing tutorial!
You always gave an amazing update about this topic
Si on a accès à la config de PHP, on peut aussi faire en sorte qu'il mette le SID en cookie.