PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > Re: [PHP] $_SESSION problem
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: [PHP] $_SESSION problem

Réponse
 
LinkBack Outils de la discussion
Vieux 11/04/2008, 00h05   #1
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] $_SESSION problem

On Thu, Apr 10, 2008 at 4:29 PM, tedd <tedd.sperling@gmail.com> wrote:

> Hi gang:
>
> I'm stumped and in need of some expert explanation.
>
> I have prepared two demos (showing code) for your enjoyment:
>
> [1] http://www.webbytedd.com/x/index.php
> [2] http://sperling.com/x/index.php
>
> Both of these demos have the exact same code; and are on the same server;
> with exactly the same php-info -- so, why do they behave differently re
> sessions?
>
> Note that [1] will retain the session values throughout the entire
> session, while [2] does not and loses session values.



as a sanity check have you dumped out the contents of the session after
writing to it on [2] ?
eg.

<?php
// ....

$_SESSION['q6'] = ( isset($_SESSION['q6']) ? $_SESSION['q6'] : 0);
$_SESSION['q7'] = ( isset($_SESSION['q7']) ? $_SESSION['q7'] : 0);
$_SESSION['q8'] = ( isset($_SESSION['q8']) ? $_SESSION['q8'] : 0);
$_SESSION['q9'] = ( isset($_SESSION['q9']) ? $_SESSION['q9'] : 0);
var_dump($_SESSION);
?>

also, doubtful or id assume youd mention it; but do you have .htaccess on
either of the sites? you might just dump out the session component of the
php config on each site to ensure theyre the same.

-nathan

  Réponse avec citation
Vieux 11/04/2008, 00h10   #2
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] $_SESSION problem

On Thu, Apr 10, 2008 at 5:05 PM, Nathan Nobbe <quickshiftin@gmail.com>
wrote:

> On Thu, Apr 10, 2008 at 4:29 PM, tedd <tedd.sperling@gmail.com> wrote:
> you might just dump out the session component of the php config on each
> site to ensure theyre the same.
>


on that last note, this could be useful,

<?php
die(var_dump(ini_get_all('session')));
?>

-nathan

  Réponse avec citation
Vieux 11/04/2008, 13h26   #3
tedd
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] $_SESSION problem

At 5:10 PM -0600 4/10/08, Nathan Nobbe wrote:
>On Thu, Apr 10, 2008 at 5:05 PM, Nathan Nobbe
><<mailto:quickshiftin@gmail.com>quickshiftin@gmai l.com> wrote:
>
>On Thu, Apr 10, 2008 at 4:29 PM, tedd
><<mailto:tedd.sperling@gmail.com>tedd.sperling@gm ail.com> wrote:
>
> you might just dump out the session component of the php config on
>each site to ensure theyre the same.
>
>
>on that last note, this could be useful,
>
><?php
>die(var_dump(ini_get_all('session')));
>?>
>
>-nathan


They are identical -- and the same as shown in phpInfo, as I said.

Cheers,

tedd


--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
  Réponse avec citation
Vieux 11/04/2008, 13h30   #4
tedd
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] $_SESSION problem

At 5:05 PM -0600 4/10/08, Nathan Nobbe wrote:
>On Thu, Apr 10, 2008 at 4:29 PM, tedd
><<mailto:tedd.sperling@gmail.com>tedd.sperling@gm ail.com> wrote:
>
>Hi gang:
>
>I'm stumped and in need of some expert explanation.
>
>I have prepared two demos (showing code) for your enjoyment:
>
>[1] <http://www.webbytedd.com/x/index.php>http://www.webbytedd.com/x/index.php
>[2] <http://sperling.com/x/index.php>http://sperling.com/x/index.php
>
>Both of these demos have the exact same code; and are on the same
>server; with exactly the same php-info -- so, why do they behave
>differently re sessions?
>
>Note that [1] will retain the session values throughout the entire
>session, while [2] does not and loses session values.
>
>
>as a sanity check have you dumped out the contents of the session
>after writing to it on [2] ?
>eg.
>
><?php
>// ....
> $_SESSION['q6'] = ( isset($_SESSION['q6']) ? $_SESSION['q6'] : 0);
> $_SESSION['q7'] = ( isset($_SESSION['q7']) ? $_SESSION['q7'] : 0);
>
> $_SESSION['q8'] = ( isset($_SESSION['q8']) ? $_SESSION['q8'] : 0);
> $_SESSION['q9'] = ( isset($_SESSION['q9']) ? $_SESSION['q9'] : 0);
>var_dump($_SESSION);
>
>?>
> you might just dump out the session component of the php config on
>each site to ensure theyre the same.
>
>-nathan


Isn't that what the code is doing?

I'm dumping the results in a print_r($_SESSION) -- isn't that he same thing?

Cheers,

tedd


--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
  Réponse avec citation
Vieux 11/04/2008, 17h23   #5
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] $_SESSION problem

On Fri, Apr 11, 2008 at 6:30 AM, tedd <tedd.sperling@gmail.com> wrote:

> Isn't that what the code is doing?
>
> I'm dumping the results in a print_r($_SESSION) -- isn't that he same
> thing?



sorry tedd; obviously i was hasty to post. but i figured just looking for
the obvious would be a good exercise as i cant count the times ive launched
into an exhaustive search for the problem when its really something silly
ive overlooked. that said; i know ur smart and you always post hard
problems for 'the gang'
anyway, taking the cue from some of the other responses, have you looked at
the page on session_write_close() ?
http://us2.php.net/manual/en/functio...rite-close.php
its kind of interesting; it looks like lots of people have run into issues
using the location header to redirect clients to another script after a form
submission. its never happened to me (knock on wood) but anyway some of the
posts on that page may be worth reading.
also, though it wont answer your question about why its happening, i was
thinking you might alter the flow of ur scripts to see if you can get the
same behavior on both sites. heres what i was thinking:
add a hidden input to the form (from index.php)

<input type="hidden" name="formsubmission" value="1" />

then after you call session_start() in index.php, have the following

if(isset($_POST['formsubmission']) && $_POST['formsubmission'] == '1')) {
include('part2.php'); // process form submission
}

then, make the following adjustments to part2.php

remove the call to session_start()
remove the call to header(location ...
remove the call to exit()

i think this will have the effect that the work flow is unaltered, but the
organization of the logic on the back end will be different. effectively
the call to header(location... will be removed so we would be able to tell
if the issue is related to that.

-nathan

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 10h30.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15976 seconds with 13 queries