top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Question about session_id() and session_start()

0 votes
324 views

I find the Note in PHP document. http://www.php.net/manual/en/function.session-id.php

"Note: When using session cookies, specifying an id for session_id() will always send a new cookie when session_start() is called, regardless if the current session id is identical to the one being set."

I feel puzzled about this feature. Even if the current session id is identical to the one one being set, session_start will send a new cookie. I want to know why session_start behave in this way.

posted May 20, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

You will find the answer in the PHP source code. If you don't want this to happen, check if the current session id matches with the value you want to set it to, and don't set if they match.

answer May 20, 2013 by anonymous
There are well over half a million lines of source code in PHP. It seems a little unhelpful to tell someone to go and read half a million lines of C when you could just tell them the answer?
0 votes

I guess it would be to help prevent session hijacks like explained here
http://stackoverflow.com/questions/12233406/preventing-session-hijacking

answer May 20, 2013 by anonymous
Similar Questions
+1 vote

Getting the following two error -
Warning:session_start() : cannot send session cookie - headers already sent by(output started at.......)
Warning:session_start() : cannot send session cache limiter - headers already sent by(output started at.......)

+3 votes

1) Implement both algorithms
2) Test both on three cases of data:
a) sorted in increase order,
b) sorted in decrease order,
c) randomly
3) Use data of different sizes: 10000, 100000, 1000000.

+1 vote

I want to use Git in a project but only some developers can Access in some folders (not all folders of the Project). Can Git limits the access to folders to users? How?

An example:
Project p_example
/scripts
/src
/docs
Users: A, B and C

Only B and C can access into scripts, src and docs folders but A only can access into scripts folder.

0 votes

I am having problems with mate DT.

If I leave the machine idle for a minute or two, (even with several windows of TB and FF open),
I end up losing the DT altogether. All Desktop icons and panels disappear. Furthermore, even if I do not leave the machine idle (i.e. I am busy on the KB),
then if I decide to suspend to disk, and later on, turn on the machine and resume,
I have no DT, as if I had left the machine idle for a minute or two.
Is this caused by a setting? Which one?

0 votes

In android-O, there is "app" folder in vendor partition.(/vendor/app)If app is in that folder and is ran, is that a vendor process?

...