I have a page (main.php) protected by psa, everything runs perfectly.
This page defines 3 frames with 3 associated php scripts let say frame1.php, frame2.php and frame3.php. In those pages I'm using some
sessions variables created in main.php.
The problem is that now that my page is
protected with psa, I can't "see" anymore my sessions variables that I have declared with $_SESSION['UserName']=$PSA_user;
for example.
And if I want to use $_SESSION['UserName']
in frame1 or any other page, I don't have anything.
This is also available for any other session variable that I define in my main page.
Any idea ?
Thanks in advance.
Bye,
Herv
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In my experience, it seems that your problem isn't from PHP or sessions, it is from using frames. What happens is that the web server sees them as separate requests. Each request is handled in the order that it is received. so if you have something like:
My website was "runing" perfectly before I used
PSA. From main.php (wich defines the frames),
I was defining some session variables wich was used
from my other pages (frame1 to frame3). Now
every session variables defined in main.php are
not visible from my other pages.
Bye,
Herv
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is $_SESSION empty in the other frames? If not, then you will need to have PSA's _restrict included before you start setting sessisons because the initial login and logout functions will destroy any open session first.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I Have removed all session_start()
and I still have the same problem.
Here is the content of _sessioninfo.txt
(I can see my test variables like UserName
and Herve) :
Open Session
Database Set to psa_db
Read Session: 62e267829f3bc5ddcb47275d2ab85dc8
SELECT value FROM psa_sessions WHERE sesskey='62e267829f3bc5ddcb47275d2ab85dc8' AND expiry > 1064416351
No Session: 62e267829f3bc5ddcb47275d2ab85dc8
Garbage Collection
DELETE FROM psa_sessions WHERE expiry < 1064416351
Affected Rows: 1
Write Session: 62e267829f3bc5ddcb47275d2ab85dc8
Check Session: 62e267829f3bc5ddcb47275d2ab85dc8
Session Data: PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";
SELECT sesskey FROM psa_sessions WHERE sesskey='62e267829f3bc5ddcb47275d2ab85dc8'
Non-existant session
New Key: 62e267829f3bc5ddcb47275d2ab85dc8
INSERT INTO psa_sessions SET sesskey='62e267829f3bc5ddcb47275d2ab85dc8', expiry=1064417792, value='PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";'
Session Data: PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";
Close Session
Open Session
Database Set to psa_db
Read Session: 62e267829f3bc5ddcb47275d2ab85dc8
SELECT value FROM psa_sessions WHERE sesskey='62e267829f3bc5ddcb47275d2ab85dc8' AND expiry > 1064416352
Session Exists: 62e267829f3bc5ddcb47275d2ab85dc8
Session Data: PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";
Garbage Collection
DELETE FROM psa_sessions WHERE expiry < 1064416352
Affected Rows: 1
Write Session: 62e267829f3bc5ddcb47275d2ab85dc8
Check Session: 62e267829f3bc5ddcb47275d2ab85dc8
Session Data: PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";UserName|s:5:"XXXXX";Herve|s:8:"MyNameXX";
SELECT sesskey FROM psa_sessions WHERE sesskey='62e267829f3bc5ddcb47275d2ab85dc8'
Key Exists: 62e267829f3bc5ddcb47275d2ab85dc8
UPDATE psa_sessions SET expiry=1064417792, value='PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";UserName|s:5:"XXXXX";Herve|s:8:"MyNameXX";' WHERE sesskey='62e267829f3bc5ddcb47275d2ab85dc8' AND expiry > 1064416352
Session Data: PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";UserName|s:5:"XXXXX";Herve|s:8:"MyNameXX";
Session Expire: 1064417792
Close Session
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hmm... I forgot that I had that debug file for sessions in the code... ;)
Well, it seems that the sessions are working properly with the database - assuming that there aren't any errors happening on that end. (Check the database to see that the queries are all successful.)
Other than that, I really wouldn't know where to look for the problem. I haven't used frames in a very long time because I didn't like the fact that the requests seemed to be processed parallel to each other, instead of one at a time.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have a page (main.php) protected by psa, everything runs perfectly.
This page defines 3 frames with 3 associated php scripts let say frame1.php, frame2.php and frame3.php. In those pages I'm using some
sessions variables created in main.php.
The problem is that now that my page is
protected with psa, I can't "see" anymore my sessions variables that I have declared with $_SESSION['UserName']=$PSA_user;
for example.
My main page begins like this :
require_once "../psa/_restrict.php";
session_start();
$_SESSION['UserName']=$PSA_user;
And if I want to use $_SESSION['UserName']
in frame1 or any other page, I don't have anything.
This is also available for any other session variable that I define in my main page.
Any idea ?
Thanks in advance.
Bye,
Herv
In my experience, it seems that your problem isn't from PHP or sessions, it is from using frames. What happens is that the web server sees them as separate requests. Each request is handled in the order that it is received. so if you have something like:
<frameset rows="100,*">
<frame src="top.php">
<frameset cols="200,*">
<frame src="left.php">
<frame src="main.php">
</frameset>
</frameset>
Then main.php is the last page to process (where the session info is created).
There are 2 solutions to this... The first is to simply replace frames with iframes. The second is to change the layout to not use frames.
Hi Justin,
My website was "runing" perfectly before I used
PSA. From main.php (wich defines the frames),
I was defining some session variables wich was used
from my other pages (frame1 to frame3). Now
every session variables defined in main.php are
not visible from my other pages.
Bye,
Herv
Is $_SESSION empty in the other frames? If not, then you will need to have PSA's _restrict included before you start setting sessisons because the initial login and logout functions will destroy any open session first.
Hi again,
$_SESSION['something'] is empty (blank)
and my page begin like this :
<?php
require_once "../psa/_restrict.php";
session_start();
...
$_SESSION['UserMonth']=$Month;
Bye,
Herv
_restrict.php already calls session_start(), so you may be causing errors. What does the error log say?
I Have removed all session_start()
and I still have the same problem.
Here is the content of _sessioninfo.txt
(I can see my test variables like UserName
and Herve) :
Open Session
Database Set to psa_db
Read Session: 62e267829f3bc5ddcb47275d2ab85dc8
SELECT value FROM psa_sessions WHERE sesskey='62e267829f3bc5ddcb47275d2ab85dc8' AND expiry > 1064416351
No Session: 62e267829f3bc5ddcb47275d2ab85dc8
Garbage Collection
DELETE FROM psa_sessions WHERE expiry < 1064416351
Affected Rows: 1
Write Session: 62e267829f3bc5ddcb47275d2ab85dc8
Check Session: 62e267829f3bc5ddcb47275d2ab85dc8
Session Data: PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";
SELECT sesskey FROM psa_sessions WHERE sesskey='62e267829f3bc5ddcb47275d2ab85dc8'
Non-existant session
New Key: 62e267829f3bc5ddcb47275d2ab85dc8
INSERT INTO psa_sessions SET sesskey='62e267829f3bc5ddcb47275d2ab85dc8', expiry=1064417792, value='PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";'
Session Data: PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";
Close Session
Open Session
Database Set to psa_db
Read Session: 62e267829f3bc5ddcb47275d2ab85dc8
SELECT value FROM psa_sessions WHERE sesskey='62e267829f3bc5ddcb47275d2ab85dc8' AND expiry > 1064416352
Session Exists: 62e267829f3bc5ddcb47275d2ab85dc8
Session Data: PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";
Garbage Collection
DELETE FROM psa_sessions WHERE expiry < 1064416352
Affected Rows: 1
Write Session: 62e267829f3bc5ddcb47275d2ab85dc8
Check Session: 62e267829f3bc5ddcb47275d2ab85dc8
Session Data: PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";UserName|s:5:"XXXXX";Herve|s:8:"MyNameXX";
SELECT sesskey FROM psa_sessions WHERE sesskey='62e267829f3bc5ddcb47275d2ab85dc8'
Key Exists: 62e267829f3bc5ddcb47275d2ab85dc8
UPDATE psa_sessions SET expiry=1064417792, value='PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";UserName|s:5:"XXXXX";Herve|s:8:"MyNameXX";' WHERE sesskey='62e267829f3bc5ddcb47275d2ab85dc8' AND expiry > 1064416352
Session Data: PSA_psaun|s:5:"XXXXX";PSA_remote|s:9:"127.0.0.1";UserName|s:5:"XXXXX";Herve|s:8:"MyNameXX";
Session Expire: 1064417792
Close Session
hmm... I forgot that I had that debug file for sessions in the code... ;)
Well, it seems that the sessions are working properly with the database - assuming that there aren't any errors happening on that end. (Check the database to see that the queries are all successful.)
Other than that, I really wouldn't know where to look for the problem. I haven't used frames in a very long time because I didn't like the fact that the requests seemed to be processed parallel to each other, instead of one at a time.
Ok, I will try to find the problem myself.
About the frames, I don't have the choice, the
customer want a site like this, that's all ;-)
Bye,
Herv