By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,637 Members | 3,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,637 IT Pros & Developers. It's quick & easy.

session_start() works wrong for me

P: n/a
xEM
I have problem with sessions. I make this without cookies but by
propagate session ID by GET.

I have make session by calling session_start() after test login and
password with database. After that i register a one session variable.

My problem is when i later call session_start(). This (second) call
make me new session (second), but not rectivate and introduce
back frozen variables of my first (correct) session to the global
namespace. I think this situation happens when URL doesn't contain
session ID. Is the reason or maybe something else ?

--
pozdr.;)
~xEM
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
xEM wrote:
I have problem with sessions. I make this without cookies but by
propagate session ID by GET.

I have make session by calling session_start() after test login and
password with database. After that i register a one session variable.

My problem is when i later call session_start(). This (second) call
make me new session (second), but not rectivate and introduce
back frozen variables of my first (correct) session to the global
namespace. I think this situation happens when URL doesn't contain
session ID. Is the reason or maybe something else ?


Hi,

Maybe you have a few pages inbetween that doesn't propagate the sessionid in
the GET?

Regards,
Erwin Moller
Jul 17 '05 #2

P: n/a

"xEM" <me@o2.pl> wrote in message news:sl***************@192.168.1.5...
I have problem with sessions. I make this without cookies but by
propagate session ID by GET.

I have make session by calling session_start() after test login and
password with database. After that i register a one session variable.

My problem is when i later call session_start(). This (second) call
make me new session (second), but not rectivate and introduce
back frozen variables of my first (correct) session to the global
namespace. I think this situation happens when URL doesn't contain
session ID. Is the reason or maybe something else ?


Yes, this is the problem. If you are not propagating the session ID via
cookie, then the only way for it to propagate is via the GET string. If you
*ever* have the browser move from one page to the next without sending that
SID in the GET string, the session, and all data associated with it, becomes
unretrievable by PHP.

You should propagate with cookies when the client will let you.

-jb
Jul 17 '05 #3

P: n/a
xEM
On 2004-03-26, Joshua Beall <jb****@donotspam.remove.me.heraldic.us> wrote:
You should propagate with cookies when the client will let you.


How can i check if clinet may use cookies ?

--
pozdr.;)
~xEM
Jul 17 '05 #4

P: n/a
> How can i check if clinet may use cookies ?

Unfortunately, I do not think there is an easy way, or even any way, to do
this within a single script. If you get the cookie back on the second page,
you know that the client is accepting cookies.

If you have transparent session IDs enabled, the PHP should automatically
try both. If it gets the cookie back on the second page, it knows that the
browser accepted the cookie on the first page, and will stop rewriting
links.

Perhaps someone who is more knowledgeable will shed some more light on this
subject.

You can read about sessions here: http://us2.php.net/session
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.